JS判断在哪个浏览器打开
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title></title> <link rel="stylesheet" href=""> <script src="jquery-1.11.1.js"></script> <script language="JavaScript" type="text/javascript"> $(function(){ getExplorer(); }) function getExplorer() { var explorer = window.navigator.userAgent ; //ie if (!!window.ActiveXObject || "ActiveXObject" in window) { alert("ie"); } //firefox else if (explorer.indexOf("Firefox") >= 0) { alert("Firefox"); } //Chrome else if(explorer.indexOf("Chrome") >= 0){ alert("Chrome"); } //Opera else if(explorer.indexOf("Opera") >= 0){ alert("Opera"); } //Safari else if(explorer.indexOf("Safari") >= 0){ alert("Safari"); } } </script> </head> <body> </body> </html>