一段 js 代码电脑跳转手机版

<script type="text/javascript">
// JavaScript Document
function urlredirect() {
var sUserAgent = navigator.userAgent.toLowerCase();
if ((sUserAgent.match(/(ipod|iphone os|midp|ucweb|android|windows ce|windows mobile)/i))) {
// PC 跳转移动端 Xyok.Net
var thisUrl = window.location.href;
window.location.href = thisUrl.substr(0,thisUrl.lastIndexOf('/')+1)+'wap/';
}
}
urlredirect();
</script>
