我找遍了,没有找到答案。我正在开发 Chrome 扩展程序,并且想知道如果用户选择在新的背景选项卡中打开链接,如何使弹出窗口保持打开状态。 (例如,在按下“ctrl”键的同时单击链接。)目前,当我这样做时,即使用户停留在当前选项卡上,弹出窗口也会关闭。
它不同于 How to keep Google Chrome Extension popup open? ,因为当用户关注不同的窗口时,弹出窗口就会关闭。我说的是当用户专门将注意力集中在弹出窗口上时,如在示例中,假设用户在单击链接时按下“ctrl”,焦点停留在当前页面上。
最佳答案
chrome.tabs.create({ url, active: false });
从文档:active (boolean, optional): Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see windows.update). Defaults to true.
引用:https://developer.chrome.com/docs/extensions/reference/tabs/
关于google-chrome - 在后台选项卡中打开链接时保持 chrome 扩展弹出窗口打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40832289/