Skip to content

Instantly share code, notes, and snippets.

@airios
Created June 24, 2011 00:35
Show Gist options
  • Select an option

  • Save airios/1043981 to your computer and use it in GitHub Desktop.

Select an option

Save airios/1043981 to your computer and use it in GitHub Desktop.
Y.Get does not fail with Webkit
<!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>
<!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>
@airios

airios commented Aug 24, 2011

Copy link
Copy Markdown
Author

Could you post your source code?

@aaronpeters

Copy link
Copy Markdown

My test page is here: http://www.aaronpeters.nl/sandbox/wpo/iframe-onload-onerror-2.html

Txs for taking a look!

@airios

airios commented Sep 7, 2011

Copy link
Copy Markdown
Author

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?

@aaronpeters

Copy link
Copy Markdown

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