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.

Answer from citruspi on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window › open
Window: open() method - Web APIs | MDN
By default, window.open opens the page in a new tab. If popup is set to true, it requests that a minimal popup window be used. The UI features included in the popup window will be automatically decided by the browser, generally including an address bar only.
🌐
W3Schools
w3schools.com › jsref › met_win_open.asp
Window open() Method
window.open("http://www.google.com/"); window.open("https://www.w3schools.com/"); Try it Yourself » · Open a new window.
Discussions

Best practices for opening new window (pop up or pop under) with JavaScript
Is there a general consensus of best practices in regards to opening a new pop up (or pop under) window with JavaScript with pop up blockers? Yeah. Don't. More on reddit.com
🌐 r/javascript
10
0
April 12, 2011
javascript - Open a URL in a new tab (and not a new window) - Stack Overflow
I've tested the below given answers from duke and arikfr and they work perfectly fine in FF, Chrome and Opera except IE (where it doesn't work) and Safari (where it opens in new window instead of new tab). 2013-04-05T07:15:44.65Z+00:00 ... @AliHaideri The Javascript has nothing to do with how ... More on stackoverflow.com
🌐 stackoverflow.com
Automatically open a new window on the browser with javascript on a website
now my question is: the author created the telegramz.org website with some js code that took the token from the url and used it to logging its device with that token. but how? i mean, the website is on some sever, how is it possible that it was able to open up a new window in the browser that automatically went to web.telegram.org/stolentokenfromvictimcomputer? Sounds like you're misunderstanding what happened. The attack website steals the login token from the URL and uses it to login to the victim account on the attacker device. This requires physical access to the victim machine. More on reddit.com
🌐 r/learnprogramming
18
1
March 10, 2025
Open in new window in JS
Hi folks, I am trying to get this to open in a new window but not sure how: console.log('before clickMe'); let clickMe = document.querySelector(".header-right a"); clickMe.addEventListener("click", (e) => { console.log("clickMe clicked."); e.preventDefault(); window.location = "http://www.... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
1
0
April 24, 2019
🌐
JavaScript.info
javascript.info › tutorial › frames and windows
Popups and window methods
A popup window is one of the oldest methods to show additional document to user. ... …And it will open a new window with given URL.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-window-open-method
JavaScript window.open() Method - GeeksforGeeks
August 5, 2025 - The Javascript window.open() method is used to open a new tab or window with the specified URL and name.
🌐
Coderanch
coderanch.com › t › 118092 › languages › options-opening-window
options for opening a new window (HTML Pages with CSS and JavaScript forum at Coderanch)
One large drawback to using a window.open() is the IE information bar that appears when a supposed pop-up is encountered. An alternative to window.open is to use the target tag on a link or form. But that doesn't give you as much control.
Find elsewhere
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Mozilla › Add-ons › WebExtensions › API › windows › create
windows.create() - Mozilla | MDN
July 17, 2025 - Move a tab from an existing window into the new window. Set the size and position of the window. Create a "panel" style window, which in this context means a window without any of the normal browser UI (address bar, toolbar, etc.). Set various properties of the window, such as whether it is focused or private. This is an asynchronous function that returns a Promise. ... boolean. When the window is opened...
🌐
DEV Community
dev.to › digvijaysingh › how-to-open-a-new-tab-or-window-using-javascript-5ebc
How to Open a New Tab or Window using Javascript? - DEV Community
October 23, 2020 - Here are the code snippets to open a link in a new tab or new window by pure Vanilla Javascript.
🌐
Reddit
reddit.com › r/javascript › best practices for opening new window (pop up or pop under) with javascript
r/javascript on Reddit: Best practices for opening new window (pop up or pop under) with JavaScript
April 12, 2011 -

Here at work, we do a fair bit of surveys on various sites via Survey Monkey. The MO has always been to do a pop under window - focus the parent, not the child/new window. I've stressed how I think this is slimey (hiding the new window), but it is what it is and that's that :)

Seems every time we have a survey, I'll get people coming to me because the new window is getting blocked by someone. I've looked at the code they're using and it's using the typical window.onload event. I tell them this is probably why they're getting blocked as the pop up blockers are no doubt seeing automatically opened windows as unwanted advertising. Because the window onload and onunload events have been so abused, this is why we have pop up blockers built into browsers as well as plugins.

I thought about perhaps using a timer to delay execution of the pop up from onload, but not sure if this will make any difference. I'm kind of guessing not but I haven't tested it yet. I can't really test it as it's another dept. that has access to the server, not me... I've also thought about using onmousemove to trigger it (user-triggered event) and then nulling that out but that seems even more stupid.

I've suggested adding static survey promos which would be user-triggered events as I think those might fare better in the world of pop up blockers - even though there's still no guarantee. So the user clicks to pop the new window.

I've also suggested removing JS from the equation altogether and having the promos link straight to Survey Monkey. The counter there is that they've lost where they are in our site (they could have deep-linked in). They can't just easily close the Survey Monkey window to pick back up where they left off in their task. Off the top of my head, I don't know if they can use their back button to backtrack from the end of the Survey Monkey survey, either.

Is there a general consensus of best practices in regards to opening a new pop up (or pop under) window with JavaScript with pop up blockers?

🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window
Window - Web APIs | MDN
Moves the window to the specified coordinates. ... Opens a new window.
🌐
Quora
quora.com › How-can-I-open-a-new-browser-window-with-JavaScript
How to open a new browser window with JavaScript - Quora
Wrote a bunch of JavaScript in 2009 for Quora. · Author has 1.5K answers and 10.6M answer views · Updated 15y · You want to call window.open and set a height in the third parameter.
🌐
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
HTML’s target="_blank" is the simplest method to open links in a new tab, requiring no additional scripting. JavaScript provides dynamic control using window.open(), making it ideal for programmatically opening links in new tabs.
🌐
Reintech
reintech.io › blog › tutorial-working-with-the-window-open-method
Working with the window.open() Method | Reintech media
January 13, 2026 - The window.open() method is a powerful function in JavaScript used to open new browser windows or tabs and manipulate existing ones. It accepts three parameters: URL, window name, and window features.
🌐
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 - JavaScript window.open() method allows you to open a new browser window or tab, with the specified URL.
🌐
Reddit
reddit.com › r/learnprogramming › automatically open a new window on the browser with javascript on a website
r/learnprogramming on Reddit: Automatically open a new window on the browser with javascript on a website
March 10, 2025 -

ok i know that the title isn't clear but i don't know how to explain it. so, i was reading at this interesting article about telegram web token: https://lyra.horse/blog/2024/05/stealing-your-telegram-account-in-10-seconds-flat/

at the end of the article the author wrote "We start off by sending “z.t.me” in their Telegram app and tapping on the link. This will redirect their browser to telegram.org/​#tgWebAuthToken=.... From here we edit the domain in the browser to telegramz.org - a domain I own - and hit/tap enter. The javascript on my domain will take it from here, logging one of my own devices in with the token."

and there is a video showing the attack: https://cdn.hobune.stream/tg_video_1080p.mp4

now my question is: the author created the telegramz.org website with some js code that took the token from the url and used it to logging its device with that token. but how? i mean, the website is on some sever, how is it possible that it was able to open up a new window in the browser that automatically went to web.telegram.org/stolentokenfromvictimcomputer?

🌐
W3Schools
w3schools.com › js › js_window.asp
JavaScript Window
Since modern browsers have implemented (almost) the same methods and properties for JavaScript interactivity, it is often referred to, as methods and properties of the BOM. The window object is supported by all browsers.
🌐
Adobe Support Community
community.adobe.com › t5 › captivate-discussions › javascript-for-opening-a-new-window-without-a-toolbar › m-p › 18828
javascript for opening a new window without a toolbar | Community
October 4, 2006 - Hi Kim, The solution is in two parts: When you create your animation, on the slide where the browser window is to open, you create a “hot spot”. In Captivate this is a “click box”. Go to Captivate -> Insert -> Click box. For the click-box properties, for On success -> select “Execute Javascript”, for function call (the next properties field, called “Continue”) insert this string of text (no spaces): MM_openBrWindow('the_link_URL.html','','width=200,height=200,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes') Set your other “click box” attributes as you want In the string (above) you can alter the characteristics of the window that is opened.
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Open in new window in JS - JavaScript - The freeCodeCamp Forum
April 24, 2019 - Hi folks, I am trying to get this to open in a new window but not sure how: console.log('before clickMe'); let clickMe = document.querySelector(".header-right a"); clickMe.addEventListener("click", (e) => …