Skip to content

Instantly share code, notes, and snippets.

@mgng
Created March 19, 2012 01:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgng/2090141 to your computer and use it in GitHub Desktop.
Save mgng/2090141 to your computer and use it in GitHub Desktop.
Flashが使えるかどうかの判定js
function FlashPlayerVer() {
var flashplayer_ver = 0;
if(navigator.plugins && navigator.mimeTypes['application/x-shockwave-flash']){
var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
if(plugin){
flashplayer_ver = parseInt(plugin.description.match(/\d+\.\d+/));
}
} else {
try{
var flashOCX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").match(/([0-9]+)/);
if(flashOCX){
flashplayer_ver = parseInt(flashOCX[0]);
}
}catch(e){}
}
if(flashplayer_ver <= 6){
flashplayer_ver = 0;
}
return flashplayer_ver;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment