10

I found two posts on this but still doesn't seem to be working. I don't see the user.js script in the drop down menu on either firebug or the built-in firefox debugger. I'm still just learning coding and couldn't figure out the workaround strategies. Any help would be greatly appreciated.

How to debug Greasemonkey script on Firefox 30?

How to debug Greasemonkey script with the Firebug extension?

Firefox 35.0

4
  • After years of problems (and no real need by power developers), I don't think this is ever going to change. Learn to code without needing a debugger (Code: console first, atomic, DRY, and unit test). ... ... If you really must have a debugger, write first in Tampermonkey with the Debug scripts option enabled. Then Chrome debug tools work. If it works in Tampermonkey, it will then work in Greasemonkey -- with only a few exceptions. Jan 15, 2015 at 3:21
  • Thanks! Looks like I've got some reading to do.
    – bigbucky
    Jan 16, 2015 at 3:38
  • stackoverflow.com/questions/25056395/…
    – tsh
    Jan 16, 2015 at 4:33
  • 4
    @tsh, Sadly, those previous answers were only effective for a time (and to limited extent -- except for the workaround parts). They seem to be obsolete now. Jan 16, 2015 at 23:14

1 Answer 1

2

The only way I've found to debug greasemonkey scripts is to use the browser console to get clues and then add alerts in my code where I think the problem is... then if the alert doesn't show up I know the problem is earlier in the code. My code usually ends up looking kinda like this pseudo code:

var i = get.value.from.page

alert(i)


do stuff to i

alert(i)

if (i===5){
do this stuff
alert ("i equaled 5")
}
else{
do this stuff instead
alert("i didn't equal 5, it equaled "+i)
}

Yeah, it's messy and time consuming... but it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.