简体   繁体   中英

What are domContentLoaded and domInteractive events?

I have read a lot of articles (also - articles at stackoverflow) avout the loading events - domContentLoaded and domInteractive, but I still do not have a clear understanding of it.

What means "interactive" in domInteractive and "content" in domContentLoaded?

  • 'interactive' is state when DOM is parsed & ready, but CSS/images/JS still may be loading, therefore DOM is ready and user can interact with it. But note, there is no such 'domInteractive' event directly, you may seek him by the 'readystatechange' event. More: https://developer.mozilla.org/ru/docs/Web/Events/readystatechange

  • 'content' inside 'domContentLoaded' is similar to 'interactive' - DOM structure parsed & ready, but some resources may be still in load. When all resources are completely loaded, happens window 'load' event and 'readystatechange' with state 'complete'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM