I need to load in different movie formats based on browser type. Specifically if the user is using firefox then I need to load in a .ocv video.
I have tried using:
alert(navigator.appName);
but this always returns ‘Netscape’ in both chrome and firefox??
Is there a better alternative?
Cheers
STOP!!! all proposed solutions are the reason the web is broken&breaking!
Don’t assume a browser, based on the name you regexp out of the userAgent, can do something or not just because it sais its an IE, Firefox or Chrome. UserAgents can be and are faked! Do a feature detection either by hand or use something fullfeatured like Modernizr
What you want to do is provided via javascript. To check if the browser can do html5 video playback;
To check if the Browser can play a certain type (mp4, ogg), use the canPlayType method of the audio/video element.
Alternativ, you can just add multiple source elements to the video element. The Browser will chose what fits best.