Created
February 10, 2011 21:21
-
-
Save DimitarChristoff/821370 to your computer and use it in GitHub Desktop.
Feature detect base64 support for images in mootools
This file contains 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() { | |
Browser.Features.base64 = null; | |
var callback = function() { | |
Browser.Features.base64 = this.width == 1 && this.height == 1; | |
// alert(Browser.Features.base64); // true || false | |
}; | |
var img = new Image(), img = document.id(img) || new Element("img"); | |
img.onload = img.onerror = img.onabort = callback; | |
// 1x1 px gif to test with | |
img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is it humanly possible to make more mistakes on a less-than-10 lines snippet? hopefully it's now done and dusted.