TAMPERMONKEY RUN AT UPDATE
I have no issues with Greasemonkey nor when I convert the userscript into a Chrome extension, it's only with Tampermonkey that I am having these complications which are making the script unusuable.Ĭan you update the extension to be more reliable in this aspect? Preferably it should follow Greasemonkey's setting, which I quote:
TAMPERMONKEY RUN AT CODE
I can't tell if this is being caused because the Tampermonkey extension is not running as soon as it should whenever the pages open or if the userscript is not being injected as soon as it should due to some slowliness caused by Tampermonkey, but this behavior is very unreliable and is forcing me to stop considering supporting my scripts for Tampermonkey because I don't know what else I can do if the extension is not reliable enough to run the code when it should or reasonably close to it. If I pack the userscript in Chrome into a testing standalone addon, which runs-at document-start there are 0 issues like this, the script runs as soon as the page exists flawlessly, so Tampermonkey should be able too. With the above script this isn't happening because I am not making it reload until it queues correctly, but you can see that the pages will be often complete before the script even has a chance to run. The worst case is when I open a new window via window.open() which the script fails to run when it should every single time for up to 10 or 20 times in a row until it is finally able to run when it should. Also I witness often that the head already contains scripts that I need to load after my script runs, not before, which can be seen in the console.log. On some cases the entire head is fully loaded and the body already started loading before the script could run, which can be confirmed by inspecting the page code after the script makes it stop. If I open a YouTube page for the first time it usually runs the script right at start when I need it, but if I open a video in a new tab (midle-click on link, for example) then sometimes this isn't true. With this simple example script for YouTube I get mixed results: // =UserScript=Ĭonsole.log(document.readyState, document.body || document.querySelector('')) However, the same isn't happening with Tampermonkey, resulting in an unreliable behavior which I was compelled to try and fix by forcing the page to reload in an attempt to get the script running when it should. Currently when using document-start with Greasemonkey my script runs when the HTML element is created, before the Head element is loaded with new elements.