Explorar o código

Callback called too soon for external scripts

When useExternalJs is enabled, the callback is called immediately for internal scripts because we don't have an onreadystatechange event (because the script is not inserted by tarteaucitron).
However, for external scripts, we do want to wait for the event to be triggered.
Pierre Rudloff %!s(int64=4) %!d(string=hai) anos
pai
achega
f29186115d
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      tarteaucitron.js

+ 1 - 1
tarteaucitron.js

@@ -1598,7 +1598,7 @@ var tarteaucitron = {
             }
 
             if (typeof callback === 'function') {
-                if ( !tarteaucitron.parameters.useExternalJs ) {
+                if ( !tarteaucitron.parameters.useExternalJs || !internal ) {
                     script.onreadystatechange = script.onload = function () {
                         var state = script.readyState;
                         if (!done && (!state || /loaded|complete/.test(state))) {