That will open a new window, not tab (with JavaScript, but quite laconically):
<a href="print.html"
onclick="window.open('print.html',
'newwindow',
'width=300,height=250');
return false;"
>Print</a>
Answer from Ievgen on Stack OverflowThat will open a new window, not tab (with JavaScript, but quite laconically):
<a href="print.html"
onclick="window.open('print.html',
'newwindow',
'width=300,height=250');
return false;"
>Print</a>
With pure HTML you can't influence this - every modern browser (= the user) has complete control over this behavior because it has been misused a lot in the past...
HTML option
You can open a new window (HTML4) or a new browsing context (HTML5). Browsing context in modern browsers is mostly "new tab" instead of "new window". You have no influence on that, and you can't "force" modern browsers to open a new window.
In order to do this, use the anchor element's attribute target[1]. The value you are looking for is _blank[2].
<a href="www.example.com/example.html" target="_blank">link text</a>
JavaScript option
Forcing a new window is possible via javascript - see Ievgen's excellent answer below for a javascript solution.
(!) However, be aware, that opening windows via javascript (if not done in the onclick event from an anchor element) are subject to getting blocked by popup blockers!
[1] This attribute dates back to the times when browsers did not have tabs and using framesets was state of the art. In the meantime, the functionality of this attribute has slightly changed (see MDN Docu)
[2] There are some other values which do not make much sense anymore (because they were designed with framesets in mind) like _parent, _self or _top.
Hi Haneen,
thank you for the quick reply. Unfortunately this does not work, at least not in the Mac version. The option simply does not appear:
For the Mac version try doing these steps and seeing if it works this way.
- Check Edge Settings:
- Open Microsoft Edge on your Mac.
- Click on the three horizontal dots (ellipsis) in the top-right corner to open the menu.
- Go to "Settings."
- Look for an option related to opening links or new windows. This might be under the "On startup" or "Privacy, search, and services" section.
- Adjust the settings according to your preference.
- Use Keyboard Shortcuts:
- When you click a link in an external application, hold down the "Command" key (⌘) on your keyboard. This might force the link to open in a new window.
- Edge Updates:
- Ensure that your Microsoft Edge browser is up to date. Updates can sometimes introduce new features or change existing behaviors.
- Mac System Preferences:
- Check your Mac's System Preferences for any default settings related to opening links in applications. For instance, you can check "General" settings to see if there are options for handling links.
Let me know if this helps!
Videos
Thanks for reply. None of those options worked. The problem is 50/50, some hyperlinks it works find, others hyperlinks it doesn't.
- Right clicking option is disabled (greyed out).
- Holding CTRL doesn't work either. It still opens it in a new browser window
- The problem seems to depend on the hyperlink.
- I ran the powershell option on a test PC and nothing changed.
- I know there is a way to fix this because my PC (profile) works just fine. I have a few other staff that work fine. But anytime I hire a new person or they log into the PC profile of their own, it reverts back to opening up links in a new window.
Chrome has a simple option that says (open links in a new tab), is there no simple setting option in edge? My company I'm contracted with requires us to use edge.
Hi JDSuser, welcome to the Microsoft community, my name is Bruno Leonel.
We will be happy to help and see if we can resolve this issue for you. Follow some of the recommended suggestions below that have helped others.
I understand that you are having problems opening links in a new tab and I will try to help you in the best way.
There are some possibilities to open a link in the same tab see below:
In Microsoft Edge, you can open a link in a new tab, just right-click on the link and then choose “Open in a new tab”
You can also use the Ctrl key (press it and keep it pressed) and click with the left mouse button and the link will open in a new tab.
NOTE: If the links that are opening in a new window are from the google search site
At the bottom of the page click settings -> search settings
And confirm that the following option is checked: "Open each selected result in a new browser window"
Give it a try, if it doesn't work, check the steps below:
To try to resolve it, follow the steps below:
step 1
With Microsoft Edge open press Alt+F;
Click "Settings" / "Reset Settings" / "Restore Settings to Default Values";
And confirm by clicking Reset;
Close the browser and open it again.
After this process, check if you are in agreement.
Step 2
Note: If when opening Microsoft Edge, a Welcome tab opens, it means that the browser has been reset. Make a backup of your bookmarks before performing this action.
Close Microsoft Edge.
Open the start menu and type PowerShell.
Right-click Run As Administrator.
Copy and paste the command below:
Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "C:\Windows\SystemApps\*Edge*\AppXManifest.xml"}
$manifest = (Get-AppxPackage *Edge*).InstallLocation + '\AppxManifest.xml' ; Add-AppxPackage -DisableDevelopmentMode -Register $manifest
After the command execution is complete, try to open Microsoft Edge.
If the answer helped in any way, please mark it as an answer, if your question has not been solved, please post again.
I hope I helped, see you later!
Problem
For Linux, if you have multiple VNC servers, this same problem will occur.
That is,
$ google-chrome
Created new window in existing browser session
And no google chrome window will appear in the current X VNC session (a new tab will appear in the X session with the first instance of google-chrome).
Solution
A simple workaround is to run
$ google-chrome "--user-data-dir=${HOME}/.google-chrome/session${DISPLAY}"
This sets a unique user directory based on the X VNC instance in use. The user directory will be created as needed. The new google-chrome process will display within the current X VNC session.
Tested using Google Chrome version 22 on Ubuntu 12.04.
There doesn't appear to be a user-friendly option to change this inside Chrome (presumably because most people prefer the new tab).
However, you can change this manually by editing the command specified in your Windows registry used to open an http url.
To do this, open regedit and:
- Go to
HKEY_CLASSES_ROOT\http\shell\open\command - You should see one key, named
(Default). Double click this to get an editing popup. - At the end of the
Value data:field you should see the text-- "%1". Change this to--new-window "%1".
That will instruct Windows to open all http links in a new window of Chrome instead of a new tab.
Presumably, the same general idea is true for Mac and Linux, but I don't know offhand where they store the command to open urls.
Specify window "features" to the open call:
window.open(url, windowName, "height=200,width=200");
When you specify a width/height, it will open it in a new window instead of a tab.
See https://developer.mozilla.org/en-US/docs/Web/API/Window.open#Position_and_size_features for all the possible features.
You don't need to use height, just make sure you use _blank, Without it, it opens in a new tab.
For a empty window:
window.open('', '_blank', 'toolbar=0,location=0,menubar=0');
For a specific URL:
window.open('http://www.google.com', '_blank', 'toolbar=0,location=0,menubar=0');
Hold the SHIFT key and left-click the link; the link will open in a new window.
I wrote a script to do this, then I set my default application in system preferences to this script for web links, works for me but not reliably and I welcome any/all better answers. I haven't found anything better in the years I've been using this though
http://smoove-operator.blogspot.com/2011/06/open-links-from-external-applications.html
[Solved]
I mean only need left click, doesn't need to hold ctrl, or using middle button, etc.
In YouTube, when I **left** click a video, it always open in current tab. But I want to force it to open in new tab and then switch to that new tab.
I tried following extensions, but they don't work at all:
Open Links in Tabs
Open Link with New Tab
Tap To Tab
Tab Mix - Links
I also tried Chrome with some extensions, also failed.
So, is there anyway to satisfy my requirement?
---
Update:
This script works perfectly for me on YouTube:
https://greasyfork.org/en/scripts/23010-open-youtube-video-links-in-new-tab
In Edge on the Extensions page, click "allow extensions from other stores." Then download Tab Activate a Chrome extension, install it in Edge. Then a click on a link opens a new tab and changes focus to the new tab.
Hi @John Mikes
Unfortunately, it seems impossible to change the default action of opening a link when you left-click it. You can try right-click a link and choose to open it in a new window. Alternatively, you can press Shift+Left click to open a link in a new window.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Regards,
Yu Zhou