Changing document.readyState property

Absesyensurry

New Member
I'm adding scripts and styles in \[code\]head\[/code\] tag if they don't exist like this:\[code\]$(function(){ var script = CL.addScriptIfMissing('someurl'); console.log(objectFromScript);});\[/code\]\[code\]addScriptIfMissing\[/code\] is working correctly.Then i call objectFromScript from loaded script and it is undefined, because on document load it was not present and it takes time to load. I have one solution:\[code\]$(function(){ var script = CL.addScriptIfMissing('someurl'); script.addEventListener('load', function(){ console.log(objectFromScript); });});\[/code\]But i need other solution: I want to change document.readyState back to \[code\]interactive\[/code\]. so that \[code\]$(document).ready\[/code\] will be stopped and called second time when script loads
 
Back
Top