One
HTML5 page JS to determine whether to install the appAt present, the browser can not directly determine whether to install the app through Google to refer to other people's way and test we know that an app installed through the scheme Jump Protocol (referral: http://www.jianshu.com/p/eed01a661186) Access to the app is not installed when the click on the link is not valid, so by clicking on the link to the implementation of the time difference between the app to determine whether to install the App 1, the following is only processedAndroid System
if(Navigator.userAgent.match (/android/i)) {varNowtime =NewDate (). ValueOf (); SetTimeout (function() {varLaunchtime =NewDate (). ValueOf ()-Nowtime; if(Launchtime < 28) {//28 is the time it takes to debug an estimated open local app .window.location = "/phone/forward/app_download_redirect";//Download the app page}},25); Window.location= "mysppscheme://";//self-defined scheme protocol}
2.iphoneUse the same principle to achieve the test effective 3,WeixinSharing the page in the URL add variable isappinstalled isappinstalled=1 when the app is installed, the value of 0 is not installed blocked URL Scheme direct jump, so weixin share page by prompting the browser to open Then determine if the app is installed based on the previous isappubstalled value.
var // whether in var // whether to install the app
The above way is I through Google to see the way you put forward and your own test the only way to not have problems of course subsequent problems will continue to update
second, decide whether to open the HTML5 page inside the appTo determine whether the current page is open within the app, a simple web front end does not address the need for clients to add their own app-related fields to useragent (useragent settings android:http://www.jincon.com/archives/ 354/) (UserAgent settings Ios:http://www.jianshu.com/p/5f02451b8e87)
var // Get useragent Isinapp = Useragent.indexof ("Sunyuki") >=0; // query If there are related fields for the app
HTML5 page JS to determine whether to install the app, and to determine whether to open the HTML5 page inside the app