Inject the autocomplete before page has loaded
vladnero opened this issue · comments
Sebastian, my friend! You said: "Nothing much I can do, if the page hasn't loaded yet, I can't inject the autocomplete.".
You can add:
"run_at": "document_start"
in "content_scripts".
See description here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/content_scripts
Tried that, doesn't change anything...
Ok. See here how can be solved: https://stackoverflow.com/questions/38577656/how-can-i-make-a-firefox-add-on-contentscript-inject-and-run-a-script-before-oth
How does it help? If you now how to fix the problem, feel free to send a pull request!
If you really want to run some script before the rest, you have to run it inline:
var actualCode = // Content of scripts/inpage.js here
;
var s = document.createElement('script');
s.textContent = actualCode;
(document.head || document.documentElement).appendChild(s);
s.remove();
Ideally, your build script would read scripts/inpage.js, serialize it to a string and put it in the actualCode variable. But if inpage.js is just a few lines of code, then the above can be used.