浏览器兼容性问题

来源:互联网 发布:linux下安装svn服务器 编辑:程序博客网 时间:2024/05/21 13:10

如何判断谷歌浏览器:

var isChrome = window.navigator.userAgent.indexOf("Chrome") !== -1;
   if(isChrome){
      if(windowFrame1.src==""&&MapAPI==null){
      windowFrame1.src="http://localhost:8080/x5/UI/gisTheme/map.html?random=" + Math.floor(Math.random()*100000);
      }
  }else{
     if(windowFrame1.location.href=="about:blank"&&MapAPI==null){
       windowFrame1.location.href = "http://localhost:8080/x5/UI/gisTheme/map.html?random=" + Math.floor(Math.random()*100000);
     }
  
  }

//IE 和非IE

 var bsessionid = location.hash.replace('#','');
        document.cookie="JSESSIONID="+bsessionid;
        if(window.addEventListener){
        window.addEventListener('hashchange',function(){
           var bsessionid = location.hash.replace('#','');
           document.cookie="JSESSIONID="+bsessionid;
       },false);
        }else if(window.attachEvent){
        window.attachEvent('onhashchange',function(){
           var bsessionid = location.hash.replace('#','');
           document.cookie="JSESSIONID="+bsessionid;
       });
        }


0 0
原创粉丝点击