[Greasemonkey] addEventListener example doesn't work?

Saravanan saravanannkl at gmail.com
Mon Sep 19 16:48:28 EDT 2005


add e.preventDefault();  to the function

(function() {
  window.addEventListener("load", function(e) {
    document.innerHTML = "Hello, world!";
   e.preventDefault(); // Add this. It will work.
  }, false);
})();

For more details 
http://dunck.us/collab/GreaseMonkeyUserScripts#head-4ac4d1e80f8bbd66bf4f1fbea77ea2390b6a2870
http://diveintogreasemonkey.org/slides/

Thanks
Saravanan


On 9/19/05, Ivan Tubert-Brohman <itub at cpan.org> wrote:
> Hi,
> 
> I had a script derived from this example from
> http://greasemonkey.mozdev.org/authoring.html :
> 
> (function() {
>    window.addEventListener("load", function(e) {
>      document.innerHTML = "Hello, world!";
>    }, false);
> })();
> 
> and it used to work (I think it was with GM 0.3). Now after upgrading GM
> and Firefox it doesn't. I'm using GM 0.5.3 with Firefox 1.0.6. I don't
> get any error messages, but the event listener is just never called. Has
> anyone had similar problems?
> 
> Thanks,
> Ivan
> 
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list