Posted By

Nettuts on 08/10/10


Tagged


Versions (?)

Who likes this?

13 people have marked this snippet as a favorite

sxnc
mchadwick
dipser
maltem
seanpowell
barbietunnie
romainsauger
mikaelholm
allproweb
antonioreyna
qubestream
leobetosouza
rentnil


Determine if Browser Understands HTML5 Video


 / Published in: JavaScript
 

  1. // Check if the browser understands the video element.
  2. function understands_video() {
  3. return !!document.createElement('video').canPlayType; // boolean
  4. }
  5.  
  6. if ( !understands_video() ) {
  7. // Must be older browser or IE.
  8. // Maybe do something like hide custom
  9. // HTML5 controls. Or whatever...
  10. videoControls.style.display = 'none';
  11. }

Report this snippet  

You need to login to post a comment.