WAP browsing automatically jump to the WAP page of the JS code _javascript tips

Source: Internet
Author: User

How to allow users to enter the WAP mobile website URL when automatically jump to WAP site?
WAP page automatic jump to achieve the way?
How can I tell if a visitor is a mobile device access and automatically jump to a WAP page?
Mobile phone automatically jump to the mobile page, a Web site to distinguish between ordinary access and mobile phone access?
When the mobile phone access to the site domain name, if the implementation of automatic jump to WAP page?

This article can solve these problems!

Copy Code code as follows:

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 ()) {
document.location.href= '/wap ';
}

The above is the JS code only need to change the/wap to you need to jump to the page can be

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.