标签:
js检测代码Html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>Plugins Test</title> 5 <script type="text/javascript"> 6 function getPluginName(){ 7 var info = ""; 8 var plugins = navigator.plugins; 9 if (plugins.length>0) { 10 for (i=0; i < navigator.plugins.length; i++ ) { 11 info += navigator.plugins[i].name+"<br/>"; 12 } 13 } 14 document.getElementById("divPlugins").innerHTML=info; 15 } 16 function getFFPlugins() 17 { 18 var info=""; 19 var plugins=navigator.mimeTypes; 20 if(plugins.length>0){ 21 for(i=0;i<navigator.mimeTypes.length;i++){ 22 info+=navigator.mimeTypes[i].type+":"+navigator.mimeTypes[i].description+"<br/>"; 23 } 24 document.getElementById("divFFPlugins").innerHTML=info; 25 } 26 } 27 window.onload=function(){ 28 getPluginName(); 29 getFFPlugins(); 30 } 31 </script> 32 </head> 33 <body> 34 <div>this is a chrome test.</div> 35 <div id="divPlugins"></div> 36 <hr/> 37 <div id="divFFPlugins"></div> 38 </body>
今天检测遇到一个问题,值得注意,检测mimeTypes时,是区分大小写的。无论你火狐插件里是大写还是小写,在chrome中都是小写,所以在做插件的时候值得注意,最好全部是小写。
标签:
原文地址:http://www.cnblogs.com/lipanpan/p/4283293.html