判断是手机还是电脑打开的页面
var system ={
win : false,
mac : false,
xll : false
};
var p = navigator.platform;
system.win = p.indexOf("Win") == 0;
system.mac = p.indexOf("Mac") == 0;
system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
if(system.win||system.mac||system.xll){
//获取当前路径
var filename=location.href;
//获取最后一个/之后的内容
filename=filename.substr(filename.lastIndexOf(‘/‘)+1);
//把数字匹配掉
var url=filename.replace(/[^a-z]/ig,"");
if(filename==‘index1‘){
var url=‘/‘;
}
window.location.href=url;
}else{
}
时间: 2024-10-13 00:15:39