js正则匹配以固定格式结尾的字符串并匹配是手机访问,则跳转
<script> //var pcUrl = "http://res.meadin.com/HotelData/98986_1.shtml"; var pcUrl = window.location.href; var str = (pcUrl.split("/")).slice(-1); if((navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) && (str[0].match(/^\d+_\d+.shtml$/g) !== null) ){window.location.href = "http:://m.meadin.com/index/index?url="+pcUrl;} </script>