How do inject a script into a website *before* the first script on this website is able to run?
8472-mozaddons at infinite-source.de
Tue Aug 15 13:07:03 UTC 2017
MutationObserver should be the right approach. Maybe post your attempt?
On 15.08.2017 14:52, Manuel Reimer wrote:
> before Firefox 55 I was able to do the following:
> Register my content script to run at "document_start".
> Then I was able to access "document.head" from there and inject my <script> as the very first script to load.
> Since Firefox 55 it seems to be impossible to do so. "document_start" seems to fire before "<head>" even exists.
> I tried to fix this with the "DOMContentLoaded" but this now is too late. Scripts embedded into <body> already ran at this point...
> Then I tried a "MutationObserver" to maybe wait for the point when <head> is inserted, but for me the MutationObserver is never fired.
> Can someone please point me into the right direction?
> Thanks in advance
> Dev-addons mailing list
> Dev-addons at mozilla.org
More information about the Dev-addons