function is_mobile() {
var regex_match = /(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220)/i;
var u = navigator.userAgent;
if (null == u) {
return true;
}
var result = regex_match.exec(u);
if (null == result) {
return false
} else {
return true
}
}
if (is_mobile()) {
// /wap换成想要跳转的url
document.location.href = '/wap';
}
浏览器检测跳转到wap页面
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 安卓一般来说都是使用scheme这种方式来实现 首先在manifest需要接收跳转页面的处理添加 <categor...
- 这周接到一个APP开发任务: 当用户从外部浏览器(如:UC、Safari)点击有关app的按钮时,实现一下功能 1...
- 主要是设置info.plist下的URL Schemes 我们开发的过程中遇到这样一个需求,如果手机下了app,就...
- 产品开发过程中难免会遇到这样的需求: 方法一:URL Scheme 将参数配置在url scheme后面,唤醒ap...