0

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.

HolyResistance
  • 594
  • 1
  • 8
  • 26

1 Answers1

2

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)
Robert
  • 2,538
  • 1
  • 9
  • 17
  • Just tested and yes it works for me too (Chrome 94). Thanks a lot. Hopefully it will still work like ten or twenty years from now. Will we ever be able to code safely without fearing more deprecation news that will kill our apps? Who knows? – HolyResistance Oct 19 '21 at 08:13