javascriptjqueryhtmlbrowserswfobject

How to Check if the browser supports HTML5?


EDIT I have changed some Javascript now, so if I can find a javascript function that detects HTML5 Video support, it should work.

I have a HTML5 video player that has flash fallback, if HTML5 isnt supported, I want it to fallback to flash. Im currently using

<!--[if !IE]><!--> then load my custom player else use SWFObject to render it.

Is it possible to do the folllowing:

`  If (HTML5 supported browser) {
 <some html and script>  (My custom player)
}else{
  <different html and script> (I would call  SWFobject here)
}
`

Trying to find a nice easy solution idea.

Usually I would be able to have an additional <object> in the video tag, but this won't be possible due to the way the player is inserted into the page.

Even though I can detect HTML5 support with a possibly unreliable method, I'm not sure how to have my HTML based on the output of the support


Solution

  • Have you had a look at http://www.modernizr.com/docs/#features-css

    It can do feature detection