Alex
Alex

Reputation: 1055

Alternative to Content Scripts?

As it stands, Google Chrome extensions can fire content scripts on a page when it is loaded.

Would there be a way to inject a script into the page before it has loaded? It would be similar to a content script except it fires when a page has been requested, instead of waiting for it to load.

Upvotes: 0

Views: 261

Answers (1)

ComFreek
ComFreek

Reputation: 29424

Have you checked out the run_at property of content scripts?

Optional. Controls when the files in js are injected. Can be "document_start", "document_end", or "document_idle". Defaults to "document_idle".
In the case of "document_start", the files are injected after any files from css, but before any other DOM is constructed or any other script is run. [...]

Source: http://developer.chrome.com/extensions/content_scripts.html

Upvotes: 4

Related Questions