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.
This commit is contained in:
Pierre Rudloff 2020-11-27 14:30:09 +01:00 committed by GitHub
parent 678ae504c6
commit f29186115d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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))) {