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.

DOMContentLoaded IE9 and above and all supported in other modern browsers.

Using 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.

The basic idea is that you 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.

The root of the linked code above is the argument:

  // 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); }   

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:

  if (document.readyState === "Full") { ago> 

Again, full argument is shown here:

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -