IIS跳转html页面自动识别是PC端还是手机端

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>  
    <title></title>
<script type="text/javascript">
window.onload=function()
{
  try{
    if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
alert('iPhone');
        window.location.href="../Mobile/Login.aspx";
    }else{
alert('pc');
        window.location.href="../Login/Login.aspx";
    }
}catch(e){}
}
</script>
</head>
<body>

</body>
</html>

 

posted @ 2015-09-25 17:41  Mark1997  阅读(1250)  评论(0编辑  收藏  举报