SlexAxton / yepnope.js

A Script Loader For Your Conditional Builds
http://yepnopejs.com/
BSD 3-Clause "New" or "Revised" License
2.51k stars 323 forks source link

yepnope 2.0 under IE 10 #229

Closed marianmeres closed 1 year ago

marianmeres commented 9 years ago

Hello Guys,

although deprecated I still use yepnope (2.0) and enjoy it very much. I have run into an issue under IE 10 where it does not seem to execute the loaded script. See this:

yepnope.injectJs('https://code.jquery.com/jquery-2.1.4.min.js', function(){
    console.log("script loaded");
    console.log(window.jQuery); // undefined under IE 10
});

It works well with yepnope 1.5.x. Any suggestions please?

Thank you Marian

full test: https://gist.github.com/marianmeres/37b3d2f7edcb21eb5531

plusplusben commented 8 years ago

Not sure if anyone still follows this, but I ran into this same issue. I was able to resolve it by moving the following line...

// Handle memory leak in IE script.onload = script.onreadystatechange = script.onerror = null;

... to after yepnope has actually finished its work.

Basically, this line is ripping the rug out from under yepnope. Once the readystate is "loading", the handler is removed. That means, we will never be notified when the readystate is "loaded".

plusplusben commented 8 years ago

One other thing, I had to remove the two blocks of code that checked for isOldIE. This seemed to resolve my issues with both IE9 and IE10.

marianmeres commented 8 years ago

Ben, I think I see your point, will try the patch soon. Thank you.

With the isOldIE flag, what were the other issues?

plusplusben commented 8 years ago

I wasn't able to figure out exactly what was going on with the isOldIE flag. Just that when that code was in there I would get a timeout. When I removed it, I got notified of successful load. The comment next to the isOldIE stuff seems to be from 2010, so I don't think IE9 and IE10 existed then.

undefineders commented 1 year ago

这是来自QQ邮箱的自动回复邮件。您好!感谢您的来邮!我会在第一时间给您回复。