如题所述
var DEFAULT_VERSION = "8.0";
var ua = navigator.userAgent.toLowerCase();
var isIE = ua.indexOf("msie")>-1;
var safariVersion;
if(isIE){
safariVersion = ua.match(/msie ([\d.]+)/)[1];
}
if(safariVersion <= DEFAULT_VERSION ){
// 进行你所要的操作
}追问
var ua = navigator.userAgent.toLowerCase();
var isIE = ua.indexOf("msie")>-1;
var safariVersion;
if(isIE){
safariVersion = ua.match(/msie ([\d.]+)/)[1];
if(safariVersion <= DEFAULT_VERSION ){
// 跳转至页面1
}else{
// 跳转至页面2
}
}else{
// 跳转至页面2
}
var ua = navigator.userAgent.toLowerCase();
var isIE = ua.indexOf("msie")>-1;
var safariVersion;
if(isIE){
safariVersion = ua.match(/msie ([\d.]+)/)[1];
}
if(safariVersion <= DEFAULT_VERSION ){
// 进行你所要的操作
}追问
能不能再完美一些,如果是ie8及ie8以下,我要显示别的页面,不显示当前页面,如果是别的浏览器我要显示当前页面
追答显示不同的页面?
var DEFAULT_VERSION = "8.0";var ua = navigator.userAgent.toLowerCase();
var isIE = ua.indexOf("msie")>-1;
var safariVersion;
if(isIE){
safariVersion = ua.match(/msie ([\d.]+)/)[1];
if(safariVersion <= DEFAULT_VERSION ){
// 跳转至页面1
}else{
// 跳转至页面2
}
}else{
// 跳转至页面2
}
温馨提示:答案为网友推荐,仅供参考
第1个回答 2017-11-21
var DEFAULT_VERSION = 8.0;
把双引号去掉就正确了。
把双引号去掉就正确了。