JavaScript open URL in a modal window | Example code

Use window open() method to popup an window tab as a modal with URL. Note: JavaScript already has ShowModalDialog function but it does not work in all browser. JavaScript open URL in a modal window Example HTML example code: Output: More parameters can use in window.open You can freeze the parent window and when the Read More…


Multiple href in one link example | JS Code

You can’t Multiple href in one link HTML alone, because there’s only a single href attribute. Use the window.open() method in JavaScript: Multiple href in one link In JavaScript Complete example code: In Anchor tag In Script In function call window.open(‘url’). Example code create a multiple link for a single <a href> tag. Output: Do Read More…


JavaScript open URL in new window/tab | Example code

Use window.open() method to open URL in new window/tab in JavaScript. Don’t forget to add target=”_blank” in the method. JavaScript open URL in new window Example HTML Example code: It will open automatics new tab with URL. Output: If you want to on click anchor tag:- Specify a width/height new window tab Do comment if Read More…


JavaScript open URL in the same window/tab | Example

There are many ways to open an URL in the same window using JavaScript. JavaScript open URL in the same window window.open location.href location.replace Output: Do comment if you have any doubts and suggestion on this JS URL code. RohitDegree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for Read More…


Get the URL without any parameters in JavaScript | Example code

There are multiple ways to Get the URL without any parameters in JavaScript. First get the get current URL get rid of the query parameters. Second concat origin and pathname, if there’s present a port such as example.com:80, that will be included as well. window.location.origin will give you the base url, in our test case: Read More…


JavaScript get query string | Current URL example

Use URLSearchParam API to get query string in JavaScript. It’s supported by all modern browsers. But you have to first get the full query string via the window.location.search property. How to get query string Example For current URL use it:- How it will work if we have a URL like this:- “https://test.com?ProjectID=462” Complete code Output: Read More…


JavaScript open URL in new tab | Example code

Use window.open() method to pen URL in new tab, but it could be open in new browser window or a new tab depending on the browser setting and the parameter values. Example code open URL in a new tab in JavaScript HTML example code: Using _blank in second parameter of window.open() to open a new Read More…



URL Info Access | Accessing a URL via web browser JavaScript

JavaScript provides you with many methods to retrieve and change the current URL, which is displayed in the browser’s address bar. All these methods use the Location object, which is a property of the Window object. You can create a new Location object that has the current URL as follows: Basic URL Structure protocol: Specifies Read More…


Open Multiple URLs with one click JavaScript | Example code

The open() method to opens a new browser window, or multiple new tab in JavaScript. Example Open Multiple URLs with one click JavaScript HTML example Code: open multiple windows on single click. Use onclick method to call window.open(‘url’). We created a function for it. Using a for loop for multiple website open. Output: window.open is Read More…