Permalink
Browse files

data uri test by phil wareham and weston ruter. fixes #14. fixes #294

  • Loading branch information...
1 parent 63aab70 commit eb5ca7975792dbbc8717626150f808bf382e19fa @paulirish paulirish committed Jun 7, 2011
Showing with 21 additions and 0 deletions.
  1. +21 −0 feature-detects/url-data-uri.js
@@ -0,0 +1,21 @@
+// data uri test.
+// https://github.com/Modernizr/Modernizr/issues/14
+
+
+// This test is ascynchronous. Watch out.
@mathiasbynens

mathiasbynens Aug 13, 2011

Contributor

define:ascynchronous

+
+(function(){
+
+ var datauri = new Image();
+
+
+ datauri.onerror = function() {
+ Modernizr.addTest('datauri', function () { return false; });
+ };
+ datauri.onload = function() {
+ Modernizr.addTest('datauri', function () { return (datauri.width == 1 && datauri.height == 1); });
+ };
+
+ datauri.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
+
+})();

0 comments on commit eb5ca79

Please sign in to comment.