I am aware that IE supports the onreadystatechange
attribute on the object
tag, but this doesn't seem to be a standard way thus all other browsers do not support it.
Update: To clarify, I am not looking for the DOM Load event, I am looking for the load event of the object
tag itself(e.g. an object
tag embedding a PDF file into a page).
In a way, I am looking for something similar to img
's onload
event /complete
attribute for the object
tag.
According to this page, you can use onload with: <body> , <frame> , <frameset> , <iframe> , <img> , <link> , and <script> .
JavaScript has a window onload event to launch certain functions whenever a web page is loaded. The onload event is also used for verification of type and version of visitor's browser. Further cookies can also be checked through the onload attribute. The attribute of onload triggers when the object is loaded in HTML.
The onload event can only be used on the document(body) itself, frames, images, and scripts. In other words, it can be attached to only body and/or each external resource. The div is not an external resource and it's loaded as part of the body, so the onload event doesn't apply there.
onload is most often used within the <body> element to execute a script once a web page has completely loaded all content (including images, script files, CSS files, etc.). However, it can be used on other elements as well (see "Supported HTML tags" below).
The <object onload>
attribute works well in latest versions of Firefox, Chrome and Opera (I've just tested it).
Also, the expression 'onload' in document.createElement('object')
evaluates to true
in Chrome and Opera; naturally, Firefox is an exception because such event support check doesn't work there generally. kangax describes cross-browser event support detection at http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With