Use window.open():
<a onclick="window.open(document.URL, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');">
Share Page
</a>
This will create a link titled Share Page which opens the current url in a new window with a height of 570 and width of 520.
Top answer 1 of 5
320
Use window.open():
<a onclick="window.open(document.URL, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');">
Share Page
</a>
This will create a link titled Share Page which opens the current url in a new window with a height of 570 and width of 520.
2 of 5
88
Just use window.open() function? The third parameter lets you specify window size.
Example
var strWindowFeatures = "location=yes,height=570,width=520,scrollbars=yes,status=yes";
var URL = "https://www.linkedin.com/cws/share?mini=true&url=" + location.href;
var win = window.open(URL, "_blank", strWindowFeatures);
TutorialsPoint
tutorialspoint.com › how-to-open-link-in-a-new-window-javascript
How to open link in a new window using JavaScript?
September 25, 2024 - Below are the Examples to Open Link in a New Window · In this example we will open a new window with the defined window dimension. <!DOCTYPE html> <html> <body style="text-align:center;"> <p> Click Button To Open New Window </p> <button onclick="newwindow()"> Open </button> <script> function newwindow() { window.open("https://www.tutorialspoint.com/css/index.htm", "", "width=500, height=500"); } </script> </body> </html>
creating links that open in a new window.__
When using publisher to create web sites, I cannot figure out how to embed a link that will open in a new window. Is there an option for that? More on learn.microsoft.com
Open link in a new window (NOT TAB) | OutSystems
I have a link on my page, and I want it to open it in a new window (not a new tab) when clicking it. Currently, this link points to a new screen action, and in this new screen action I have a RunJavaScript server action with the following script: · However, it still open the link in new tab ... More on outsystems.com
Using html button + javascript function to open links in new window - JavaScript - SitePoint Forums | Web Development & Design Community
Hi all, Im trying to set up a function where once a html button is pressed, a function checks a variable and redirects a link to a new window if the value comes back positive. This is the function I’m trying to get goi… More on sitepoint.com
How to Open Page in New Tab
Need to add “target=“_blank” after your href attribute More on reddit.com
Videos
08:53
Opening New Windows or Tabs from JavaScript
01:38
How to Open a URL in a New Tab Using JavaScript & HTML - YouTube
01:05
How to Open Multiple Links in a New Window with JavaScript - YouTube
00:52
JavaScript Open Link in New Window - YouTube
Open Link in New Window using JavaScript
Open Link in New Tab using JavaScript - YouTube
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window › open
Window: open() method - Web APIs | MDN
The open() method of the Window interface loads a specified resource into a new or existing browsing context (that is, a tab, a window, or an iframe) under a specified name.
Medium
medium.com › @progmacattack › open-a-link-in-a-new-window-with-vanilla-javascript-1e8298612b8f
Vanilla Javascript: Open a link in a new window | by Adam S. | Medium
November 16, 2015 - var portfolioLinks = document.getElementById("portfolio-details"); portfolioLinks.addEventListener("click",portfolioLinkClicked,false) }//if a portfolio link is clicked, open in new window function portfolioLinkClicked(e) { var url = e.target.href; window.open(url,"","titlebar=no"); } There are a lot of customization options from here. ... <a href=”http://codepen.io/asickmiller/full/KdXXZE/" onclick=”return false”>Wikipedia Search</a><br /> Well that keeps the html from loading the link at all. What I mean is, since Javascript is loading the link from the href string in a new window, we don’t want our HTML doing the same thing in the background.
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-open-url-in-new-tab-using-javascript
How to Open URL in New Tab using JavaScript? - GeeksforGeeks
In this example · When clicked, it runs the NewTab() function. window.open("https://www.geeksforgeeks.org////", "_blank"); opens the GeeksforGeeks website in a new tab. Here are the applications of opening URLs in new tabs: External Links: ...
Published August 21, 2025
W3Schools
w3schools.com › jsref › met_win_open.asp
Window open() Method
Animation Events Clipboard Events Drag Events Events Focus Events HashChange Events Input Events Keyboard Events Mouse Events PageTransition Events PopState Events Progress Events Storage Events Touch Events Transition Events Ui Events Wheel Events HTML Event Properties · altKey (Mouse) altKey (Key) animationName bubbles button buttons cancelable charCode clientX clientY code ctrlKey (Mouse) ctrlKey (Key) currentTarget data defaultPrevented deltaX deltaY deltaZ deltaMode detail elapsedTime elapsedTime eventPhase inputType isTrusted key keyCode location metaKey (Mouse) metaKey (Key) newURL oldURL offsetX offsetY pageX pageY persisted propertyName relatedTarget relatedTarget screenX screenY shiftKey (Mouse) shiftKey (Key) target targetTouches timeStamp touches type which (Mouse) which (Key) view HTML Event Methods
Educative
educative.io › answers › how-to-open-a-link-in-a-new-tab-with-html-and-javascript
How to open a link in a new tab with HTML and JavaScript
We use _blank to tell the window.open() method to open the link in a new tab. We can use HTML to open links in new tabs when adding simple links in static content, such as articles or navigation menus.
RapidTables
rapidtables.com › web › html › link › html-link-new-window.html
HTML link in a new window
<a href="../html-link.htm" target="_blank">Open page in new window</a> ... You can't set whether the link will be opened in a new window or new tab. It depends on the browser's settings. In order to open a link in a new window, add Javascript command onclick="window.open('text-link.htm', ...
CSS-Tricks
css-tricks.com › snippets › html › open-link-in-a-new-window
Open Link in a New Window | CSS-Tricks
May 14, 2013 - Here’s more people with the same issue stackoverflow link ... has usually always worked on every browser. target=”new” not so much however but target=”_new” usually does. ... Hello HarBek… You can use target=”_anything” ….This is not complusory to use “new” after underscore….because this is not a keyword..Any browser can take it as command to open new window.. :) ... This topic is missing something important. Is there a way using CSS and HTML to open internal links in same window and external links in new window?
OutSystems
outsystems.com › forums › discussion › 65977 › open-link-in-a-new-window-not-tab
Open link in a new window (NOT TAB) | OutSystems
I have a link on my page, and I want it to open it in a new window (not a new tab) when clicking it. Currently, this link points to a new screen action, and in this new screen action I have a RunJavaScript server action with the following script: · However, it still open the link in new tab ...
SitePoint
sitepoint.com › javascript
Using html button + javascript function to open links in new window - JavaScript - SitePoint Forums | Web Development & Design Community
August 1, 2018 - Hi all, Im trying to set up a function where once a html button is pressed, a function checks a variable and redirects a link to a new window if the value comes back positive. This is the function I’m trying to get going: function launchTask() { window.open("https://www.google.com","_blank"); } and the button button type=“button” onclick=“LaunchTask()” Theres probably a basic solution i’m not seeing, can somebody help?
Reddit
reddit.com › r/html › how to open page in new tab
r/HTML on Reddit: How to Open Page in New Tab
November 21, 2024 -
I'm trying to add some HTML to a website that will automatically open a different page in a new tab. I know how to create a link that the user can click on, but I'm hoping to have it occur automatically upon loading the site. Does anyone have any suggestions?
Top answer 1 of 3
1
Need to add “target=“_blank” after your href attribute
2 of 3
1
If you want a page to automatically open in a new tab when someone visits your site, you can use a bit of JavaScript to make it happen. Here's a quick example: Just replace https://example.com with the URL you want to open. Drop this code into the or near the top of your page, and it’ll pop open the new tab as soon as the page loads. BUT, a heads-up: auto-opening new tabs can be annoying for users, and some browsers block it by default. You might want to think about whether there's a better way to get the info to your users (like a prominent link/button).