views:

49

answers:

1

I've a userscript as the following:

document.addEventListener('click', alert('hello monkey'), true);

There were two problems:

  1. "hello monkey" is alerted only when refreshing the browser, not work when clicking window.

  2. using GM's 'manage user script' to edit the script, the change doesn't happen. (The source code on the local disc was changed.)

+5  A: 

You need to bind it so it isn't executed automatically...

document.addEventListener('click', function(){alert('hello monkey')}, true);

Not sure about #2 though.

meder