js to get the client browser

 1 if(getExplorer() == "IE"){
 2     pagesetup_null();
 3  }
 4 window.print();
 5 function pagesetup_null(){                
 6     var hkey_root,hkey_path,hkey_key;
 7     hkey_root="HKEY_CURRENT_USER";
 8     hkey_path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
 9     try{
10         var RegWsh = new ActiveXObject("WScript.Shell");
11         hkey_key="header";
12         RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
13         hkey_key="footer";
14         RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
15     }catch(e){}
16 }
17 
18 function getExplorer() {
19     var explorer = window.navigator.userAgent ;
20     //ie 
21     if (explorer.indexOf("MSIE") >= 0) {
22         return "IE";
23     }
24     //firefox 
25     else if (explorer.indexOf("Firefox") >= 0) {
26         return "Firefox";
27     }
28     //Chrome
29     else if(explorer.indexOf("Chrome") >= 0){
30         return "Chrome";
31     }
32     //Opera
33     else if(explorer.indexOf("Opera") >= 0){
34         return "Opera";
35     }
36     //Safari
37     else if(explorer.indexOf("Safari") >= 0){
38         return "Safari";
39     }
40 }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324811874&siteId=291194637