charminglee

客户端对于非指定浏览器转到指定页(只是为了以后使用方便,无参考价值)

 function NeedUpperBrowserVersion()
{
 redirectUrl="/NeedUpperBrowserVersion.htm";
 var version=navigator.appVersion;
 if (navigator.appVersion.indexOf("MSIE")!=-1)
 {
  temp=navigator.appVersion.split("MSIE");
  temp=temp[1].split(";");
  version=parseFloat(temp[0]);
  if(version<5.5)
  {
   window.location.href=redirectUrl;
  }
 }
 else if(navigator.appName.toUpperCase()=="NETSCAPE")
 {
  version=parseFloat(navigator.appVersion);
  if(version<6.0)
  {
   window.location.href=redirectUrl;
  }
 }
 else
 {
  window.location.href=redirectUrl;
 }
}

注:以下也有可能用到的,引用
Detecting Firefox 1.0+
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
if(navigator.userAgent.indexOf("Firefox")!=-1){
var versionindex=navigator.userAgent.indexOf("Firefox")+8
if (parseInt(navigator.userAgent.charAt(versionindex))>=1)
alert("You are using Firefox 1.x or above")
}
As IE6: Mozilla/4.0 (compatible; MSIE 6.0; Windows XP) Opera 8.5 [en]
As Moz5: Mozilla/5.0 (Windows XP; U) Opera 8.5 [en]
As Opera: Opera/8.5 (Windows XP; U) [en]
if(navigator.userAgent.indexOf("Opera")!=-1){
var versionindex=navigator.userAgent.indexOf("Opera")+6
if (parseInt(navigator.userAgent.charAt(versionindex))>=8)
alert("You are using Opera 8 or 9")
}

posted on 2005-12-29 14:44  charming  阅读(216)  评论(0)    收藏  举报

导航