日期:2014-05-16  浏览次数:20367 次

请大神帮写一个Js判断代码
我需要在一个网页上指定只能用2345加速浏览器打开,用其他任何浏览器打开都提示需要下载,只能用2345加速浏览器才可以,在线坐等大神协助

求判断Js
------解决方案--------------------
if(navigator.userAgent.indexOf('2345Explorer')==-1){
  alert('请用2345浏览器查看本页面!')
 location='跳转到你要的页面,如2345浏览器的下载地址'
}

------解决方案--------------------
引用:
if(navigator.userAgent.indexOf('2345Explorer')==-1){
  alert('请用2345浏览器查看本页面!')
 location='跳转到你要的页面,如2345浏览器的下载地址'
}

------解决方案--------------------
引用:
Quote: 引用:

if(navigator.userAgent.indexOf('2345Explorer')==-1){
  alert('请用2345浏览器查看本页面!')
 location='跳转到你要的页面,如2345浏览器的下载地址'
}


这判断代码应该没问题,但是无法判断到2345浏览器 郁闷呢 我用2345浏览器打开它依然提示要我使用2345浏览器

 (Windows NT 6.2; Trident/7.0; rv:11.0; like Gecko; 2345Explorer 3.2.0.12012) 


说明你的userAgent没有包含2345Explorer,严格区分大小写的,自己输出userAgent对比下不就知道了

if(navigator.userAgent.indexOf('2345Explorer')==-1){
  alert('请用2345浏览器查看本页面!\nuserAgent'+navigator.userAgent.)
 location='跳转到你要的页面,如2345浏览器的下载地址'
}