Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dispatch window load event

I need to dispatch the window's load event in Javascript. There is plenty of documentation on how to dispatch mouse events, But I can't find any on load events. It only needs to work in Firefox. It would be equally helpful if I could "spy" on the window's load event, because then I could just call the function. Using the "Event spy" addon isn't working because it requires me to open the dom inspector, which i can't do until after the page is finished loading.

I'm making a grease monkey script. So I don't know which function it is that I'm trying to invoke.

like image 728
user185383 Avatar asked Nov 08 '09 17:11

user185383


1 Answers

var load_event = document.createEvent('Event');  
load_event.initEvent('load', false, false);  
window.dispatchEvent(load_event);

works fine in my environment.

like image 148
user2167460 Avatar answered Oct 27 '22 00:10

user2167460