Determine if the mobile side is open or the PC is open

Source: Internet
Author: User

Decide if it's a mobile phone or a computer-opened page
var system ={        win : false,         mac : false,        xll  : false        };         var p = navigator.platform;        system.win  = p.indexof ("Win")  == 0;        system.mac =  p.indexof ("Mac")  == 0;        system.x11 =  ( p ==  "X11")  | |   (P.indexof ("Linux")  == 0);         if (system.win| | system.mac| | SYSTEM.XLL) {//Get current path             var   filename=location.href;//get the last/after content             filename=filename.substr (Filename.lastindexof ('/') +1);  //match the numbers out              var url=filename.replace (/[^a-z]/ig, "");             if (filename== ' index1 ') {                 var url= '/';             }             window.location.href=url;        }else{          }

Determine if the mobile is open or the PC is open

Related Article

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.