Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load events for embedded elements

If I do an online onload event for embedded objects, that seems to work but I can't seem to get the load event working through addEventListener. Is this expected?

like image 206
Geuis Avatar asked Apr 11 '09 22:04

Geuis


People also ask

What is the purpose of the Load event?

The load event is fired when the whole page has loaded, including all dependent resources such as stylesheets and images. This is in contrast to DOMContentLoaded , which is fired as soon as the page DOM has been loaded, without waiting for resources to finish loading.

Is there an onload function in JavaScript?

The onload in javascript is compatible with loading elements like CSS files, images, script files, etc. within a web page. The onload events are one of the most used and primarily part of the <body> tag.

How can we handle events in JavaScript?

Many different methods can be used to let JavaScript work with events: HTML event attributes can execute JavaScript code directly. HTML event attributes can call JavaScript functions. You can assign your own event handler functions to HTML elements.


1 Answers

Probably, but it may be browser dependent.

windows and images and iframes define their load events with addEventListener and attachEvent, but other load events are browser specific.

A script or link element's onload doesn't attach in IE, for instance.

like image 144
kennebec Avatar answered Oct 28 '22 08:10

kennebec