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?
<!DOCTYPE html> <html> <body> <p>Click Button To Open New Window</p> <button onclick="newwindow()">Click</button> <script> function newwindow() { window.open("https://www.tutorialspoint.com/javascript/index.htm", "_blank","toolbar=no,scrollbars=no,resizable=yes,top=500,left=500,width=400,height=400"); } </script> </body> </html>
Videos
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
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', ...
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.
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?
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).
Squash
squash.io › how-to-open-a-url-in-a-new-tab-using-javascript
How to Open a URL in a New Tab Using JavaScript
To open a URL in a new tab using JavaScript, you can use the window.open() method. This method opens a new browser window or tab, depending on the user's browser settings.
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 ...
University of New Mexico
unm.edu › ~tbeach › IT145 › week13 › example10.html
Javascript Opening Windows
Let's not specify the extra settings and let it open in a new window with this link. <p>Let's not specify the extra settings and let it open in a new window with this <a href="javascript:location='example10.html'; window.open('../index.html', 'demo2')">link</a>.</p>