以编程方式在后台打开一个新的浏览器选项卡 [英] open a new browser tab in background programmatically
问题描述
我使用的是基于网络的提要阅读器,TinyTinyRSS.在筛选提要列表时,我想在新选项卡中打开有趣的文章 - 但在后台,因为我只想在浏览所有提要项目后阅读它们.
I'm using a web-based feed reader, TinyTinyRSS. When sifting through the feed lists, I'd like to open interesting articles in new tabs - but in the background, because I want to read them only after I went through all feed items.
TT-RSS 有一个快捷键o"可以在新标签中打开文章,但它会在前台打开标签(window.open
).
TT-RSS has a shortcut key "o" to open the article in a new tab, but it opens the tab in the foreground (window.open
).
现在的问题是:要修复 TT-RSS,我需要知道如何从 javascript 中打开背景标签.如果该解决方案能够跨浏览器(Firefox、Chrome、Opera、Safari)工作,那就太棒了.
The question is now: To fix TT-RSS, I need to know how to open a background tab from javascript. It'd be awesome if the solution worked across browsers (Firefox, Chrome, Opera, Safari).
我了解这方面的隐私问题,但是为一个经过认证的网页启用它是可以的.
I understand the privacy issue about that, but having it enabled for one certified webpage is ok.
在 about:config
中,将 browser.tabs.loadDivertedInBackground
设置为 true
.这会在后台打开页面中的所有选项卡,这不是我想要的 - 我只希望它用于一个应用程序/网站.
In about:config
, set browser.tabs.loadDivertedInBackground
to true
.
This opens all the tabs from pages in the background, which is not what I want - I want it only for the one application/website.
Chrome 有一个 shytab 扩展程序.仅适用于 chrome,适用于所有页面.
Chrome has a shytab extension. Works in chrome only and is for all pages.
推荐答案
当弹出式广告出现时,这被称为popunder"窗口.Popunders 曾经做过这样的事情:
Back when popup ads were a thing, this was called a "popunder" window. Popunders used to do something like this:
var popupWindow = window.open(...);
popupWindow.blur();
window.focus();
弹出窗口阻止有点混乱,什么有效什么无效,不过 - 你的里程可能会有所不同.
Popup blocking kind of messed around with what does and doesn't work, though- your mileage may vary.
这篇关于以编程方式在后台打开一个新的浏览器选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!