4 ms·
> On a side node, if anyone has resource about how to dev/debug userscript properly, I'm all ears. I found it super inconvenient and tedious when doing it mysel
by cookie_monsta 5y ago
> On a side node, if anyone has resource about how to dev/debug userscript properly, I'm all ears. I found it super inconvenient and tedious when doing it myself, and I often have to manually copy paste stuff back and forth.
Agreed. Even stranger is that some errors end up in the console but others do not. Syntax errors particularly seem to fail silently.
If I'm putting together something that I know will be more than a dozen lines or so (or is targeting a page sitting behind logins and extra navigation) I will just save the target page as a local file and write the JS into that file and debug as normal until it's working, then copy the JS over to a userscript.
- jtvjan 5y agoAt least for Firefox, you can look at the browser error console (Ctrl+Shift+J) to always see error messages, even if the script failed to inject.
- cookie_monsta 5y agoNot for me. This: // ==UserScript== // @name HN test // @version 1 // @grant none // @include https://news.ycombinator.com/\\ https://news.ycombinator.com/\\* // ==/UserScript== alert("hello" shows nothing in a userscript, but: Uncaught SyntaxError: missing ) after argument list test.htm:23 in a local page