Skip to content

Instantly share code, notes, and snippets.

@karlcow
Created May 9, 2014 01:33
Show Gist options
  • Select an option

  • Save karlcow/3b4c3d0f1ac6e296332a to your computer and use it in GitHub Desktop.

Select an option

Save karlcow/3b4c3d0f1ac6e296332a to your computer and use it in GitHub Desktop.
and everything else which is not… something in this category, go to hell ;)
deviceCanPlayFlash: function(){
//TODO - for now, return false for IPhone and IPad
try
{
if(
(navigator.userAgent.match(/iPhone/i))
|| (navigator.userAgent.match(/iPod/i))
|| (navigator.userAgent.match(/iPad/i))
|| (navigator.userAgent.match(/android/i))
|| (navigator.userAgent.match(/Windows Phone/i))
)
{
return false;
}
// Assume "Linux x86_64" is a desktop request site from Android device, try to detect instead
else if (navigator.userAgent.match(/Linux x86_64/i))
{
if("ActiveXObject" in window) {
try{
return !!(new ActiveXObject("ShockwaveFlash.ShockwaveFlash"));
} catch(e) {
return false;
}
} else {
try{
return !!navigator.mimeTypes['application/x-shockwave-flash'];
} catch(e) {
return false;
}
}
return false;
}
}
catch(e){}
return true;
},
deviceCanPlayMP4: function(){
//TODO - for now return true
return true;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment