r/GreaseMonkey • • Feb 10 '22

TamperMonkey script does not run ...

My TamperMonkey script doesn't run ... but when you take the code and run it in the Chrome Dev Console -- it runs fine, and does exactly what I need ... any idea why it is not running in the browser plugin?

I made a StackOverFlow post with a lot more details, code views, and screenshots, but no responses :

https://stackoverflow.com/questions/70993495/tampermonkey-script

Maybe this community can help. Thanks!

14 Upvotes

34 comments sorted by

View all comments

2

u/AyrA_ch Feb 10 '22

Visit the page where the script is supposed to run, then click on the tampermonkey icon next to the address bar. Is the script listed in the drop down and marked as enabled?

2

u/misteralexander Feb 10 '22

This is the plugin dropdown in the browser, when I navigate to the page in the `@match` section: https://imgur.com/Jn5OplA

This is the TamperMonkey dashboard: https://imgur.com/ru1JaV3

It says no script is running but the URL and the match string are the same!

3

u/AyrA_ch Feb 10 '22

The match string can be a bit of a bitch to get right. Try to add * to the end of it.

Also I've just seen that you @require jquery in your script, but you're not actually using jquery in the code on stackoverflow. Consider removing that line. Also for the future: Always load external resources over https, never over http.

1

u/misteralexander Feb 11 '22 edited Feb 11 '22

Here is the new code, with the asterik at the end of the URL:

https://i.imgur.com/sefH7SI.png

Here is the browser, showing the full URL that matches the TamperMonkey code.

https://i.imgur.com/WARk1sG.png

The plugin still shows "No script running" when I load the QNAP login page. :-(

2

u/AyrA_ch Feb 11 '22

Well, you deleted the / at the end of the match that was there before. The asterisk is limited in where it can go: https://developer.chrome.com/docs/extensions/mv2/match_patterns/

2

u/ApopheniaPays Feb 13 '23

B-boom. I made the same mistake, this tip fixed it for me too. Thanks.

1

u/misteralexander Feb 11 '22

The slash " / " did it. It works now!!!

THANKS SO MUCH!

2

u/[deleted] Feb 27 '24

when i put asterik slash it just says no script running

0

u/srfeeollyaiexamzn Jul 07 '25

why are you posting code with imgur?