-2

I'm looking through some code from GitHub and I can't seem to figure out why this line of code is there, nor can I find anything about it online.

window.addEventListener("load", function() {

What does "load" do?

malabeh
  • 101
  • 1
  • 2
  • 9
  • https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onload – plalx Mar 01 '15 at 06:16
  • `load` is an event. See https://html.spec.whatwg.org/multipage/browsers.html#read-html and https://developer.mozilla.org/en-US/docs/Web/Events/load – Felix Kling Mar 01 '15 at 06:19
  • @roshan: I don't think the OP want's to build a Firefox add-on. – Felix Kling Mar 01 '15 at 06:26
  • 1
    a quick google of "window load" returns all the information i could ever need.... try http://stackoverflow.com/questions/3698200/window-onload-vs-document-ready – Angry 84 Mar 01 '15 at 06:37

1 Answers1

0

The window.onload event is used to kick-start web applications. This could be something trivial like animating a menu or something complex like initializing a mail application.

The onload event fires after all page content has loaded.

https://developer.mozilla.org/en-US/docs/Web/Events/load

also look at the following link

https://developer.mozilla.org/en-US/Add-ons/Code_snippets/On_page_load

R4nc1d
  • 2,923
  • 3
  • 24
  • 44