Skip to content

Instantly share code, notes, and snippets.

@ekashida
Last active December 17, 2015 01:09
Show Gist options
  • Save ekashida/5526397 to your computer and use it in GitHub Desktop.
Save ekashida/5526397 to your computer and use it in GitHub Desktop.
[bogus] Checking if the onload and onerror events fire for link tags on Android 2.3.4
<!doctype html>
<head>
<style>
#good,
#bad {
font-size: 30px;
width: 300px;
height:150px;
}
</style>
<script src="http://3vnx.localtunnel.com/target/target-script-min.js"></script>
<script src="http://yui.yahooapis.com/3.10.0/build/yui/yui-min.js"></script>
</head>
<body>
<h1>Testing invalid CSS resource "bogus" on Android 2.3.4</h1>
<button id="good">VALID CSS</button>
<button id="bad">INVALID CSS</button>
</body>
</html>
YUI().use('node', function (Y) {
Y.one('#good').on('click', function (e) {
Y.Get.css('http://yui.yahooapis.com/3.3.0/build/cssreset/reset-min.css', {
onSuccess: function () {
Y.log('reset-min.css onSuccess handler');
},
onFailure: function () {
Y.log('reset-min.css onFailure handler');
}
}, function (err) {
if (err) {
Y.log('[reset-min.css - callback] passed an error: ' + err.message);
return;
}
Y.log('[reset-min.css - callback] loaded successfully!');
});
console.log('clicked on VALID');
});
Y.one('#bad').on('click', function (e) {
Y.Get.css('http://eugene.me/bogus', {
onSuccess: function () {
console.log('bogus onSuccess handler');
},
onFailure: function () {
console.log('bogus onFailure handler');
}
}, function (err) {
if (err) {
Y.log('[bogus - callback] passed an error: ' + err.message);
return;
}
Y.log('[bogus - callback] loaded successfully!');
});
console.log('clicked on INVALID');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment