简体   繁体   中英

Is there event that triggers after DOM was loaded but before any external assets like images, styles,iframes, etc?

I'd would also like to pause fetching of external files until my event function finishes, is it possible ? If not on clean JS, maybe with jQuery ?

There is no such event cause you can't be ensure that no file was loaded before the DOM tree is build. Its an asynchrones process, where the DOM is parsed and builded. Whenever the parser comes to a link for an external file, he starts to load this. So when it could happend that some of these files are loaded before the parsed comes to the end of the body tag. Maybe you're looking for something different.

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