This is a trick,
function openInNewTab(url) {
window.open(url, '_blank').focus();
}
// Or just
window.open(url, '_blank').focus();
In most cases, this should happen directly in the onclick handler for the link to prevent pop-up blockers, and the default "new window" behavior. You could do it this way, or by adding an event listener to your DOM object.
<div onclick="openInNewTab('www.test.com');">Something To Click On</div>
Reference: Open a URL in a new tab using JavaScript
Answer from Duke on Stack OverflowThis is a trick,
function openInNewTab(url) {
window.open(url, '_blank').focus();
}
// Or just
window.open(url, '_blank').focus();
In most cases, this should happen directly in the onclick handler for the link to prevent pop-up blockers, and the default "new window" behavior. You could do it this way, or by adding an event listener to your DOM object.
<div onclick="openInNewTab('www.test.com');">Something To Click On</div>
Reference: Open a URL in a new tab using JavaScript
Nothing an author can do can choose to open in a new tab instead of a new window; it is a user preference. (Note that the default user preference in most browsers is for new tabs, so a trivial test on a browser where that preference hasn't been changed will not demonstrate this.)
CSS3 proposed target-new, but the specification was abandoned.
The reverse is not true; by specifying certain window features for the window in the third argument of window.open(), you can trigger a new window when the preference is for tabs.
Videos
Supposedly it's middle mouse button, but obviously I'm lacking that. In other browsers it was generally ctrl+click (on a link) to open a link in a new tab. But that isn't working.
Can't find any options in the settings either to change it. Is there a workaround, or an addon/extension for this?
Edit: To clarify, I'm not talking about Ctrl+T. That just opens a blank tab, or my last closed tab.
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!
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?