Yes, you can create an HTML link that opens a URL in a new window with specific dimensions using JavaScript. Modern browsers typically default to opening links in new tabs, but providing specific width and height parameters in the window.open() method often forces the browser to open a new window (popup) instead.

To achieve this, you can use an anchor tag with an onclick event that calls window.open(). Here is the standard approach:

<a href="https://www.example.com" 
   onclick="window.open(this.href, 'newWindow', 'width=800,height=600,left=100,top=100'); return false;">
   Open in New Window
</a>

Key Details:

  • this.href: Retrieves the URL from the anchor tag.

  • 'newWindow': A name for the window; using the same name reuses the existing window if it is already open.

  • 'width=800,height=600,...': The third parameter is a comma-separated string of window features. Including width and height is the most reliable way to ensure a new window opens rather than a tab. You can also specify left and top to position the window.

  • return false;: Prevents the default link behavior (opening in the current tab) so only the JavaScript function executes.

Alternative: Programmatic Creation

If you need to create the link dynamically or without inline JavaScript, you can use an event listener:

<a href="https://www.example.com" id="splitLink">Open in New Window</a>

<script>
document.getElementById('splitLink').addEventListener('click', function(e) {
    e.preventDefault(); // Prevent default navigation
    window.open(this.href, 'splitWindow', 'width=800,height=600');
});
</script>

Important Considerations:

  • Popup Blockers: Browsers may block windows opened via window.open() if they are not triggered by a direct user action (like a click). Ensure the function is called directly from a click event.

  • Browser Settings: While specifying dimensions increases the likelihood of a new window, some browsers may still respect user preferences for tabs over popups.

  • Security: If opening a cross-origin URL, the opened window will be subject to the same-origin policy, meaning the opener cannot access its DOM for security reasons.

AI-generated answer. Please verify critical facts.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window › open
Window: open() method - Web APIs - MDN Web Docs - Mozilla
*/ windowObjectReference.focus(); } else { windowObjectReference.focus(); } previousURL = url; /* explanation: we store the current url in order to compare url in the event of another call of this function. */ } const links = document.querySelectorAll( "a[target='SingleSecondaryWindowName']", ); for (const link of links) { link.addEventListener("click", (event) => { openRequestedSingleTab(link.href); event.preventDefault(); }); }
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-open-url-in-a-new-window-using-javascript
How to open URL in a new window using JavaScript? - GeeksforGeeks
August 21, 2025 - This approach is straightforward and commonly used for external links, enhancing user experience by keeping the current page intact. Example: Use Anchor tag to open URL in a new window using JavaScript.
Top answer
1 of 3
2

WMV is not a format supported by the HTML5 video player in browsers. You should try converting your video to a support format like h264 (mpeg) or webm.

On top of that, you may want to create an actual player.html page that you can load in the newly opened window so that you're able to configure settings like autoplay, which player controls are visible, etc. This could also give you the opportunity to allow video format fallbacks in case one of the encoded video formats is not supports, another will be chosen.

You could avoid having to create separate player pages for each video by passing a query string parameter in the URL that tells the player page which video to load.

2 of 3
0

It seems you have a few issues here.

Forcing browser to open a link in a new window

It's important to note, that messing with expected browser's behaviour is morally wrong. You should always let user decide how he wants to open a particular link.

However, if you really need to know, here's the answer. In the past, attribute target="_blank" used to open links (and forms) in a new window, but it doesn't anymore. Since browsers got more friendly, it'll just open the result in a new tab.

If you want to force browser to open a link in a new window, you need to use window.open() function. However, I beg you, do not throw it around too much. If you absolutely need to implement this function, at least make it a little bit less evil, like the following (so you're only adding a class .new-window without ugly onclick-s or anything like that:

(function(){
  var links = document.querySelectorAll('a.new-window');
  for (var i = 0; i < links.length; ++i) {
    links[i].addEventListener('click', function(e) {
      e.preventDefault();
      // Note that it'll not work inside SO snippets preview because of the sandbox!
      // Try on http://codepen.io/xerif/pen/JWggoJ
      window.open(this.getAttribute('href'), '', [
        'width=' + screen.availWidth,
        'height=' + screen.availHeight
      ]);
      // Also note that array will be converted to proper string automagically
      // I used array for readability
    });
  }
})();
<a href="http://stackoverflow.com/q/43333255">Normal link</a> / 
<a href="http://stackoverflow.com/q/43333255" target="_blank">Open in a new tab (probably)</a> /
<a href="http://stackoverflow.com/q/43333255" class="new-window">Open in a new window</a>
Run code snippetEdit code snippet Hide Results Copy to answer Expand

  ▲ try it on codepen.io (snippets on SO are sandboxed)

It's worth noting, that window.open should not be blocked by popup blockers as long as window originated from user's action. However, if you try to open a window without user initiating that action — silently, by something like a timer or keyboard event — it will be blocked.

Unsupported media type

As other people have hinted, there's no such thing as Windows Media Player in web environment. It just doesn't exist. Forget you know it. Do it.

Instead, you may want to use video tag. As I understand, FBI prohibits you from putting training videos on YouTube, so you'll need to convert them to more appropriate format, like webm or h.264. Then:

<video src="\\OC2-RMGFS\Public\Safety\runhidefight-eng.mp4" poster="./images/Youtube.png">
  We can't play this video in your browser. Can you <a href="\\OC2-RMGFS\Public\Safety\runhidefight-eng.mp4" download>download it</a>?
</video>
Run code snippetEdit code snippet Hide Results Copy to answer Expand

🌐
SysTutorials
systutorials.com › how-to-open-a-url-in-a-new-window-in-javascript
Opening Links In New Windows And Tabs With JavaScript - SysTutorials
April 11, 2026 - const url = "https://www.systutorials.com"; const popup = window.open(url, "myWindow"); // Later, you can check if the window is still open if (popup && !popup.closed) { popup.focus(); // Bring it to focus }
🌐
Stack Overflow
stackoverflow.com › questions › 60245697 › create-hyperlink-that-open-in-new-tab-window-using-external-javascript
create hyperlink that open in new tab/window using external javascript - Stack Overflow
Something like that but I'll need to create that function in js file instead but I'm not sure how 2020-02-16T05:53:37.053Z+00:00 ... Use the target="_blank" to opens the linked document in a new window or tab.
Find elsewhere
🌐
RapidTables
rapidtables.com › web › html › link › html-link-new-window.html
HTML link in a new window
In order to open a link in a new window, add Javascript command onclick="window.open('text-link.htm', 'name','width=600,height=400') inside the <a> tag:
Top answer
1 of 3
2

This is how to open a link in a new window.

<a href="myLink" 
 target="popup" 
 onclick="window.open('myLink','popup','width=600,height=600'); return false;">
   Open Link in Popup
</a>

Always remember the sometimes that user configures their browsers to block all new tabs and windows (at least this is what I do), to avoid annoying advertisements and click baits links.

2 of 3
1

Any method which opens a new browser context without specifying the dimensions will use either a tab or a window according to the user's preferences.

In general, it isn't a good idea to try to bypass that preference. If a user decides they want a tab in a new window, they can always tear it off into one.

That said, if you specify dimensions, it will trigger a new window if the browser supports that at all (most mobile devices, for example, don't support windows at all).

addEventListener("click", event => {
    const target = event.target;
    if (!target.classList.contains("force-window")) {
        return;
    }
    const url = target.href;
    const width = window.innerWidth;
    const height = window.innerHeight;
    const features = `width=${width},height=${height}`;
    window.open(url, "_blank", features);
    event.preventDefault();
});
<a href="myLink" target="_blank" rel="noreferrer" class="force-window">myText</a>

Unfortunately, this will produce a window missing most of the expected features. See the window.open documentation to add them back, but note that (in Chrome at least) adding the menubar back will cause the height and width to be ignored and put things back in a new tab.

Author controlled new windows are a pain and are almost always best avoided. I wouldn't touch them unless I needed to do something like pop out some content (like a chat or music player) in a small window that could remain on screen while the user navigated the site … and even then I'd generally lean towards writing a SPA instead.

🌐
Stack Overflow
stackoverflow.com › questions › 70134512 › can-the-text-in-a-url-make-the-link-open-in-a-new-window
target - Can the text in a URL make the link open in a new window? - Stack Overflow
The only type of URL that has the power to specify a new window open is is javascript: URL. If you could modify both the beginning and the end of the the URL, you might be able to embed it in JS.
🌐
W3docs
w3docs.com › home › code snippets › html › how to open hyperlink in a new window
How to Open Hyperlink in a New Window | W3docs
There is another way of opening a hyperlink in a new tab by using the JavaScript window.open function with the <span class="attribute">onclick</span> event attribute like this: How to use JavaScript window.open function with the onclick event ...
🌐
Delft Stack
delftstack.com › home › howto › javascript › open url in a new window javascript
How to Open URL in a New Window With JavaScript | Delft Stack
March 14, 2025 - In this snippet, we create an anchor tag that links to “https://www.example.com”. By adding target="_blank", we instruct the browser to open the link in a new window or tab when clicked.

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
can we create an html link that would open the given url in a new split window using javascript? - Brave Search