1. 程式人生 > >判斷瀏覽器類型代碼

判斷瀏覽器類型代碼

android tor text ash PE agen ace repl redirect

<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

判斷瀏覽器類型代碼