Created
November 2, 2012 03:24
-
-
Save zmmbreeze/3998539 to your computer and use it in GitHub Desktop.
Using JavaScript to check if images are enabled
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
(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