JS to determine if an app is installed on your mobile device

Source: Internet
Author: User

One: Judging is the kind of device

var isandroid = u.indexof (' Android ') >-1 | | U.indexof (' Linux ') >-1; Android Terminal or UC Browser
var Isios =!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/); iOS terminal

Two: Android device: Principle: Judge whether to know this agreement, know the direct jump, do not know to download the app here

Android ();

if (isandroid) {
Function Android () {
Window.location.href = "OPENWJTR://COM.TYRBL.WJTR"; /*** opens the app protocol, with Android colleagues providing ***/
Window.settimeout (function () {
Window.location.href = "http://www.wjtr.com/download/index.html"; /*** opens the app protocol, with Android colleagues providing ***/
},2000);
};

Two: iOS device: principle: Ibid.

iOS ();
if (Isios) {
function iOS () {
var IFR = document.createelement ("iframe");
IFR.SRC = "OPENWJTR://COM.TYRBL.WJTR"; /*** Open the app protocol and have iOS colleagues provide ***/
Ifr.style.display = "None";
Document.body.appendChild (IFR);
Window.settimeout (function () {
Document.body.removeChild (IFR);
Window.location.href = "http://www.wjtr.com/download/index.html"; /*** Download the app's address ***/
},2000)
};
}

JS to determine if an app is installed on your mobile device

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.