google-chrome - 在后台选项卡中打开链接时保持 chrome 扩展弹出窗口打开

标签 google-chrome google-chrome-extension

我找遍了,没有找到答案。我正在开发 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/

相关文章:

google-chrome-extension - chrome.storage.local 异常行为 : confused by a duplicate object

google-chrome - 在 manifest.json 中创建 Google Chrome 扩展通配符

javascript - Chrome 扩展程序 : browserAction. onClicked.addListener() 未被调用

javascript - 如何处理 chrome 扩展面板的 onSearch 事件?

javascript - 如何使 Priority 列出现在 Chrome Devtools Network 选项卡中

google-chrome - 在 Ubuntu 上开发 Chrome 扩展程序就像是一种痛苦

google-chrome - 简单地替换渐进式 Web 应用程序的图标会导致 list 中出现错误

javascript - 我如何搜索整个数组以找到它的键?

android - 在 Android 版 Chrome 中通过 Google ID 自动登录

jquery - $.get - 不允许来源