kubetail-org / loadjs

A tiny async loader / dependency manager for modern browsers (899 bytes)
MIT License
2.57k stars 149 forks source link

Old browsers (Opera12) can't use document.head #107

Closed viT-1 closed 1 year ago

viT-1 commented 1 year ago

Your code failed on doc.head.appendChild It should be doc.querySelector('head').appendChild

amorey commented 1 year ago

On which version of Opera12 did you see an error and what is the error message? I just tested the following code on Opera 12.15 and it works:

<!doctype html>
<html>
  <head>
    <title>Opera12 Test</title>
  </head>
  <body>
    <script>
      (function (doc) {
        var el = doc.createElement('script');
        el.src = 'doesntexist.js';
        doc.head.appendChild(el);
      })(document);
    </script>
  </body>
</html>
viT-1 commented 1 year ago

Strange... This failed only if Developer tools is already open. Opera 12.18

amorey commented 1 year ago

Hmm... maybe developer tools has a setting enabled that's changing the default behavior. Have you noticed the error in a context that affects users? Can I close this issue?