如何在我自己的扩展中获取刚打开的页面而不是 chrome 特殊页面

How to get just opened pages not chrome special pages in my own extension

我想打开标签页,但不打开空的新标签页、书签标签页、下载标签页等等。我该怎么做?

使用 *://*/*,其中第一个 * 与文档中的 httphttpsmore info 匹配。

chrome.tabs.query({url: '*://*/*'}, tabs => {
  // process tabs here
});

如果您也想包含 file:// 个标签:

chrome.tabs.query({url: ['*://*/*', 'file://*/*']}, tabs => {
  // process tabs here
});