简体   繁体   中英

How to make Chrome fire the load/onload event on a script tag without jQuery

Problem: Chrome not firing load/onload on script elements. The issue has been mentioned previously in,

Chrome not properly observing onload event on script tags?

Trying to fire the onload event on script tag

It looks like a proper answer hasn't been given about how to make it happen without jQuery.

Im using somting like this in script and it works ok.

 const url = `https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js` const script = document.createElement('script'); script.async = true; script.onload = () => console.log("script loaded") script.src = url; document.head.appendChild(script)

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