Created
June 24, 2011 00:35
-
-
Save airios/1043981 to your computer and use it in GitHub Desktop.
Y.Get does not fail with Webkit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>Y.Get Example</title> | |
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script> | |
</head> | |
<body> | |
<h1>Y.Get Example</h1> | |
</body> | |
<script type="text/javascript"> | |
YUI().use(function(Y) { | |
// This should fail for Safari | |
var ua = Y.UA, | |
url = (ua.webkit) ? "http://yui.yahooapis.com/combo?3.3.0/build/yui/yui-min-oops.js" : "http://yui.yahooapis.com/combo?3.3.0/build/yui/yui-min.js"; | |
obj = Y.Get.script(url, { | |
onSuccess: function() { | |
alert("Success!"); | |
}, | |
onFailure: function(e) { | |
alert("Failure!"); | |
} | |
}); | |
}); | |
</script> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>Safari onLoad Working Example</title> | |
</head> | |
<body> | |
<h1>Safari onLoad Working Example</h1> | |
</body> | |
<script type="text/javascript"> | |
(function(){ | |
var n = document.createElement('script'); | |
n.addEventListener("load", function(){ | |
alert("Success! Loaded URL.") | |
}); | |
n.addEventListener("error", function(){ | |
alert("Failed to load URL."); | |
}); | |
n.async = "async"; | |
n.type = "text/javascript"; | |
n.src = "http://yui.yahooapis.com/combo?3.3.0/build/yui/yui-min-oops.js" | |
document.getElementsByTagName('head')[0].appendChild(n); | |
})(); | |
</script> | |
</html> |
Could you post your source code?
My test page is here: http://www.aaronpeters.nl/sandbox/wpo/iframe-onload-onerror-2.html
Txs for taking a look!
I just got around to checking this out. I ran on Chrome 13, Safari, & FF, and all of them worked fine. Did you end up finding the problem?
Do you mean my test page works fine in those browsers?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Abel,
I tried to get the the error event to fire on an iframe, simply by modifying your works.html code on line 12 and 21 and removing lines 19 and 20. It does not fire in IE9 and Chrome13. If you can share anything with me that might help me, please do. I'd appreciate it. aaron [at] aaronpeters [dot] nl