javascript - DOMContentLoaded event does not fire -
I wanted to try Javascript's DOMContentLoaded event. But there is no fire in that event. It is not supported on IE. Please help with this. I did not get much help on Googling. I do not want to try it in javascript and jquery please help with this.
Using The basic idea is that you The root of the linked code above is the argument: It is also possible that you are registering for the document because the document is already ready. If this is the case then your event handler will never be called because the incident has already happened. If it is already ready in such a way, to see if you can see the document status before installing the event handler: Again, full argument is shown here: DOMContentLoaded IE9 and above and all supported in other modern browsers.
onreadystatechange is a work-environment for early versions of IE. Here you can see a complete cross-browser, plain JavaScript content loaded detection function: which you can either use or you can borrow concepts from code.
DOMContentLoaded in the modern browsers and in the earlier versions of IE, you
onreadystatechange from the fallback
window onload Use. First of all, there is a fire which is safe to inquire and modify the document.
// Otherwise if we do not have an event handler installed, install them (document.addEventListener) {// The first choice is the DOMContentLoaded event document.addEventListener ("DOMContentLoaded", ready, wrong); // Backup window load event window. AddEventListener ("Load", Ready, Wrong); } Other {// should be IE document.attachEvent ("onreadystatechange", readyStateChange); Window.attachEvent ("Onload", Ready); }
if (document.readyState === "Full") {
ago>
Comments
Post a Comment