I'm loading a script by Javascript after an ajax call. For this I'm using this code:
var imported = document.createElement('script'); imported.src = 'https://www.example.com/scripts/form.js'; imported.type = 'text/javascript'; document.head.appendChild(imported);
This Javascript file ( https://www.example.com/scripts/form.js
) will run on Google Chrome, Edge and Firefox after it's added to the head
of the document, but not on IE 11. What code must I add to execute that script on IE?
我发现在Googling之后我是否只是在添加此行代码之前将其添加到head
。
imported.onreadystatechange = function () { }; // For IE 11
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.