判断浏览器类型代码

<script type="text/javascript">
function uaredirect(murl) {
try {
if(document.getElementById("bdmark") != null) {
return
}
var urlhash = window.location.hash;
if(!urlhash.match("fromapp")) {
if((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i))) {
location.replace(murl);
}
}
} catch(err) {}
}
uaredirect("wap.html");
</script>

如果是非PC浏览,则转换wap.html

posted @ 2018-06-12 18:26  独行的心  阅读(282)  评论(0编辑  收藏  举报