PC端和移动端代码是分开的,各有一套代码的情况下:
在PC端的HTML文件head标签中间添加一段自动识别移动端的JavaScript代码:
<script type="text/javascript">
if(/Android|webOS| iPhone | iPad | iPod |BlackBerry|opera mini|opera mobile|appleWebkit.*mobile|mobile/i.test(navigator.userAgent)) {
window.location.replace("{{url('/wap/anti')}}");
}
</script>