js method for Deeplink

Source: Internet
Author: User

This article mainly introduces the JS method used for Deeplink (to determine whether the phone is installed app), the need for friends can refer to the

Code function: To determine whether the mobile phone/tablet install app if installed then call app scheme, pass in URL as parameter, follow up if not installed then jump to app store/google play download app code as follows: (function () {var o Penurl = Window.location.search; try{OpenURL = openurl.substring (1,openurl.length);} catch (e) {} var Isios = Navigator.userAgent.match (' iPad ') | | Navigator.userAgent.match (' IPhone ') | | Navigator.userAgent.match (' IPod '), isandroid = navigator.useragent. Match (' Android '), Isdesktop =!isios&&! isandroid; if (Isios) {settimeout (function () {window.location = "itms-apps://itunes.apple.com/app/[name]/[id]?mt=8";},25); window.location = "[scheme]://[host]?url=" +openurl; }else if (isandroid) {window.location = "intent://[host]/" + "url=" +openurl+ "#Intent; Scheme=[scheme];p ackage=[package _name];end "; }else{window.location.href = OpenURL}}) ();

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.