Описание тега content-script

NoneF Content scripts are JavaScript files, used by browser extensions or add-ons. They are the part of an extension that can interact with the document context of the current web page. This mainly applies to Firefox or Chrome extensions.

Content scripts are JavaScript files, used by browser extensions or add-ons. They are the part of an extension that can interact with the document context of the current web page. This mainly applies to Firefox or Chrome extensions.

Content scripts interact with a webpage via the DOM API, and they frequently have enhanced privileges and access to privileged browser-API functions compared to ordinary webpage javascript.

For this reason, content scripts are isolated from a target-page's javascript by scoping, and/or sandboxing, and/or anonymous function wrapping. Content-script javascript cannot (normally) directly interact with a page's javascript objects, and vice versa.

Content scripts are very similar to userscripts and Greasemonkey scripts, but as part of full-fledged extensions (add-ons), content scripts can have both more powerful options and more involved coding requirements.

References:


Related tags: