url-data-uri.js 694 B

1234567891011121314151617181920212223242526
  1. // data uri test.
  2. // https://github.com/Modernizr/Modernizr/issues/14
  3. // This test is asynchronous. Watch out.
  4. // in IE7 in HTTPS this can cause a Mixed Content security popup.
  5. // github.com/Modernizr/Modernizr/issues/362
  6. // To avoid that you can create a new iframe and inject this.. perhaps..
  7. (function(){
  8. var datauri = new Image();
  9. datauri.onerror = function() {
  10. Modernizr.addTest('datauri', function () { return false; });
  11. };
  12. datauri.onload = function() {
  13. Modernizr.addTest('datauri', function () { return (datauri.width == 1 && datauri.height == 1); });
  14. };
  15. datauri.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
  16. })();