记录一种js判断是否要跳到移动端的方法

it2026-03-14  3

// 进入时判断移动端跳转 var is_mobi = navigator.userAgent.toLowerCase().match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null; if (is_mobi) { window.location.href = "/mobile/index.html"; } else { }

通过navigator对象中的方法来判断浏览器是否为移动端的方式

最新回复(0)