Is it possible to open a new tab in Firefox (in background) using window.open("http://www.google.com")
function, and remain the current tab?
Thanks for any help
Yes, either change the browser preferences or use whatever key and click combination is required for that browser to open the link in a new tab but keep focus on the current on.
To open a new tab, we have to use _blank in the second parameter of the window. open() method. The return value of window. open() is a reference to the newly created window or tab or null if it failed.
1) select "open link in new background tab" from the context menu (second choice), 2) use middle-click on the link with your mouse; 3) use Ctrl+leftclick on the link with your mouse, 4) designate a mouse gesture to open a background tab when you perform it over a link.
You can't open tabs in the background using javascript because this is set in the user's preferences in about:config
, which you have no control over. The setting is:
browser.tabs.loadDivertedInBackground=true
Whether or not to focus a new tab when it is opened is a browser setting and not something that you can control.
Opening links in a new tab at all (rather than a separate window) is a browser setting too, so you're facing an uphill battle with this one.
Basically, leave it up to the user to decide how they want to open links.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With