【发布时间】:2021-12-24 21:30:24
【问题描述】:
我正在开发一个 chrome 扩展项目,但无法使匹配模式正常工作,因此它涵盖了用户经过域的所有地方。举个例子,如果用户去https://www.google.com/imghp?hl=en 让代码在那里再次执行。这可以在 background.js 文件中执行吗?
chrome.webNavigation.onCompleted.addListener(function() {
alert("This is my favorite website!");
}, {url: [{urlMatches : '*://www.google.com/*'}]});
我已尝试使用变量来表示“://www.google.com/”,例如:
var site = "*://www.google.com/*"
will not let me pass this into either url: 'site'
or {url: [{urlMatches : 'site'}
【问题讨论】:
标签: javascript google-chrome google-chrome-extension google-chrome-devtools