- // 判断浏览器类型
- function getExplorer() {
- var explorer = window.navigator.userAgent ;
- //ie
- if (!!window.ActiveXObject || "ActiveXObject" in window) {
- return "ie";
- }
- //firefox
- else if (explorer.indexOf("Firefox") >= 0) {
- return "Firefox";
- }
- //Chrome
- else if(explorer.indexOf("Chrome") >= 0){
- return "Chrome";
- }
- //Opera
- else if(explorer.indexOf("Opera") >= 0){
- return "Opera";
- }
- //Safari
- else if(explorer.indexOf("Safari") >= 0){
- return "Safari";
- }else{
- return "other";
- }
- }