function getrootpath(){ //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp var curwwwpath=window.document.location.href; curwwwpath=(curwwwpath.indexof("html")>-1?curwwwpath:curwwwpath+"index.html"); return(curwwwpath); } function browserredirect() { var suseragent= navigator.useragent.tolowercase(); var bisipad= suseragent.match(/ipad/i) == "ipad"; var bisiphoneos= suseragent.match(/iphone os/i) == "iphone os"; var bismidp= suseragent.match(/midp/i) == "midp"; var bisuc7= suseragent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; var bisuc= suseragent.match(/ucweb/i) == "ucweb"; var bisandroid= suseragent.match(/android/i) == "android"; var bisce= suseragent.match(/windows ce/i) == "windows ce"; var biswm= suseragent.match(/windows mobile/i) == "windows mobile"; if (bisipad || bisiphoneos || bismidp || bisuc7 || bisuc || bisandroid || bisce || biswm) { if(getrootpath().indexof("_wap.html")>-1){ }else{ var url = getrootpath(); url = url.substring(0,url.length-10)+"index_wap.html"; window.location= url; } } else { if(getrootpath().indexof("_wap.html")>-1){ var url = getrootpath(); url = url.substring(0,url.length-9)+".html"; window.location= url; } } } browserredirect();