A segment small code. The same site for mobile viewing and computer-side view jump different pages.
First, load the jquery file.
$ (function () {var Mobileua = (function () {var ua = navigator.userAgent.toLowerCase (); var mua = {IOS:/ipod|iphone|ipad/.test (UA),//ios iphone:/iphone/.test (UA),//iphone I PAD:/ipad/.test (UA),//ipad ANDROID:/android/.test (UA),//android Device WINDOWS:/windows/.test (U A),//windows Device touch_device: (' ontouchstart ' in window) | | /touch/.test (UA),//touch device MOBILE:/mobile/.test (UA),//mobile device (IPAD) android_tablet:f Alse,//android tablet windows_tablet:false,//windows tablet tablet:false,//tablet (IPad, Androi D, Windows) smart_phone:false//smart Phone (iPhone, Android)}; Mua. Android_tablet = Mua. ANDROID &&!mua. MOBILE; Mua. Windows_tablet = Mua. WINDOWS &&/tablet/.test (UA); Mua. TABLET = Mua. IPAD | | Mua. Android_tablet | | Mua. Windows_tablet; Mua. Smart_phone = Mua. MOBILE &&!mua. TABLET; return MUA; }()); SmartPhone if (mobileua.smart_phone) {//Mobile-link address document.location.href = ' Http://www.aaa.com/wap/ind Ex.html '; }});
jquery infers whether the browser is mobile or computer-side to jump on its own initiative