Use the Navigator object to check the plugin in the browser, implementing the code below.
1 //ie4+, Firefox, Chrome, Safari, Opera, using navigator detection plug-in, name for the plug -in Names2 functionHasplugin (name) {3Name =name.tolowercase ();4 for(vari = 0; i < navigator.plugins.length; i++) {5 if(Navigator.plugins[i].name.tolowercase (). IndexOf (name) >-1) {6 return true;7 }8 }9 return false;Ten } One //ie4-using COM object detection plug-in, name is the COM identifier of the plug -in A functionHasieplugin (name) { - Try { - NewActiveXObject (name); the return true; -}Catch(ex) { - return false; - } + } - //Check if there is a flash plugin in the browser + functionHasflash () { A varresult = Hasplugin ("Flash"); at if(!result) { -result = Hasieplugin ("Shockwareflash.shockwareflash"); - } - returnresult; - } -Alert (Hasflash ());
Checking plugins in the browser with the Navigator object