How to specify which content scripts will be run on all_frames and which not?

When specifying parameters in the chrome extension manifest file, there is an all_frames option. This allows you to create content scripts in all frames of the page or not.

An example of what I want to achieve is a.js working with all_frames = false and b.js with all_frames=true .

+1
source share
1 answer

The content_scripts manifest property is an array, so you can define several script specification objects:

 "content_scripts": [ { "matches": ["http://www.google.com/*"], "css": ["mystyles.css"], "js": ["a.js"], "all_frames": false }, { "matches": ["http://www.yahoo.com/*"], "js": ["b.js"], "all_frames": true } ], 
+4
source

Source: https://habr.com/ru/post/1483841/


All Articles