Home > Java > javaTutorial > body text

How to detect whether a client is installed in Android and IOS browsers

高洛峰
Release: 2017-01-17 14:40:27
Original
1157 people have browsed it

We hope that more users will use our products, and we hope to retain more users. At this time, the significance of letting users use the client becomes particularly important.

After all, the client actually occupies the user's desktop, and they will see our products more or less every day.
Then, as a mobile web product, users access our page through the mobile browser, and we hope that users can directly use or download our client product.
Finally, there is a talk about downloading Banner.

IOS

Speaking of IOS, what is very exciting is that since IOS6, we only need to add meta tags to html.
The specific meta tag is:
Of course, for a more specific description, please refer to Apple's developer platform Document: Promoting Apps with Smart App Banners
What about IOS6 and below?
My answer is: just display a download banner.

Android

For Android, if we are careful, we will find that many applications will always be running in the background. Can't even turn it off.
In this way, we can determine whether our App is installed by sending a request to this background process, and then judging whether the request responds correctly.
If there is no correct response, we assume that our client application is not installed.
The basic idea is this, let’s look at the code implementation:

(function() {
    var isInstalled,
        url = '_url_', // 找android工程师要吧
        script = document.createElement('script');
    script.src = url;
    script.onload = function() {
        // alert('Is installed.');
        isInstalled = true;
    };
    script.onerror = function() {
        // alert('May be not installed.');
        isInstalled = false;
    }
    document.body.appendChild(script);
})();
Copy after login

For more related articles on how to detect whether a client is installed in Android and IOS browsers, please pay attention to the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!