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.
複数のコンテンツ スクリプトが 1 つのページに挿入された拡張機能がある場合、すべてのコンテンツ スクリプトにブロードキャストするのではなく、ページ上の特定のコンテンツ スクリプトに対処することは可能ですか? ありがとう!
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' }); }