Skip to content

Instantly share code, notes, and snippets.

@zmmbreeze
Created November 2, 2012 03:24
Show Gist options
  • Save zmmbreeze/3998539 to your computer and use it in GitHub Desktop.
Save zmmbreeze/3998539 to your computer and use it in GitHub Desktop.
Using JavaScript to check if images are enabled
(function() {
var image = new Image();
image.onload = function() {
if (image.width > 0) {
document.documentElement.className += (document.documentElement.className != '') ? ' images-on' : 'images-on';
}
};
image.src = 'px.png';
}());
// http://www.456bereastreet.com/archive/201211/using_javascript_to_check_if_images_are_enabled/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment