Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the first event fired when a web page is loaded to the browser

As asked in the title, what's the first event fired when a web page is loaded to the browser? I believe there are events before window.onload. What are they, and which one is the first fired?

like image 794
Paul Avatar asked Jul 23 '10 02:07

Paul


1 Answers

If you're looking to invoke an event handler before onload, DOMContentLoaded is one event that usually fires before.

document.addEventListener('DOMContentLoaded', functionRef, false);
like image 118
meder omuraliev Avatar answered Nov 14 '22 02:11

meder omuraliev