Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果您有一个将多个内容脚本注入单个页面的扩展程序,是否可以解决页面上的特定内容脚本而不是广播到所有内容脚本?谢谢!
如果我理解正确,您可以在您的中执行您的内容脚本,background.js而不是在您的中定义它manifest.json:
background.js
manifest.json
if (condition) { chrome.tabs.executeScript(null, { file: 'contentscript1.js' }); } else { chrome.tabs.executeScript(null, { file: 'contentscript2.js' }); }