Options on where to inject script
Currently, it seems to inject the script at the bottom of the body element. This is causing me an issue currently as I am trying to set a cookie before window.onload.
It would be nice to have a drop-down that allows you to put it in any of these positions:
- First script in HEAD tag
- Last script in HEAD tag
- First script in BODY tag
- Last script in BODY tag
- Call before defined window's "on load" event. (example see below)
- Call after defined window's "on load" event
- Call before defined document's "on load" event
- Call after defined document's "on load" event
- Call before defined document.body's "on load" event
- Call after defined document.body's "on load" event
Window before window.onload event example
(I just wrote this quickly I didn't test it but should work or at least shouldn't be hard to get it working)
window.onload_old = window.onload;
window.onload = function()
{
beforeOnLoad.apply(beforeOnLoad, Array.prototype.slice.call(arguments, 0));
window.onload_old.apply(window.onload_old, Array.prototype.slice.call(arguments, 0));
}
I would very much like to second this. For probably most of my use cases, I'd want to be applying scripts before the page's own javascript is running. Other than that, this extension is great. I've long wanted something like this.