img-webp.js 473 B

1234567891011121314151617181920
  1. // code.google.com/speed/webp/
  2. // by rich bradshaw, ryan seddon, and paul irish
  3. // This test is asynchronous. Watch out.
  4. (function(){
  5. var image = new Image();
  6. image.onerror = function() {
  7. Modernizr.addTest('webp', false);
  8. };
  9. image.onload = function() {
  10. Modernizr.addTest('webp', function() { return image.width == 1; });
  11. };
  12. image.src = 'data:image/webp;base64,UklGRiwAAABXRUJQVlA4ICAAAAAUAgCdASoBAAEAL/3+/3+CAB/AAAFzrNsAAP5QAAAAAA==';
  13. }());