Skip to content

Instantly share code, notes, and snippets.

@fearphage
Created October 13, 2009 16:08
Show Gist options
  • Save fearphage/209338 to your computer and use it in GitHub Desktop.
Save fearphage/209338 to your computer and use it in GitHub Desktop.
// one-liner
javascript:(function(src, count) { var img = new Image || document.createElement('img'); img.addEventListener('error', function() { if (!count) img.src = src; else alert('PASS'); count = 1; }, false); img.src = src; })('data:text/plain,fail')
// prettified
javascript:(function(src, count) {
var img = new Image || document.createElement('img');
img.addEventListener('error'
,function() {
if (!count)
img.src = src;
else
alert('PASS');
count = 1;
}
,false
);
img.src = src;
})('data:text/plain,fail')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment