I am writing an extension need to run at document start. I tried placing the code outside appAPI.ready in the extension.js file but it's still running too late. In chrome I use the "run_at": "document_start" option. How can I do the same in my Crossrider extension.
Asked
Active
Viewed 296 times
1 Answers
1
To run code a document start, you inject the script via the background.js code using the [appAPI.dom.onDocumentStart.addJS][1] method. For example:
appAPI.dom.onDocumentStart.addJS({
js:"alert('hello world!');"
});
[Disclosure: I am a Crossrider employee]
[1] http://docs.crossrider.com/#!/api/appAPI.dom.onDocumentStart-method-addJS

Shlomo
- 3,763
- 11
- 16