Click a button to jump directly to the app if it is installed, or jump to the download link if it is not.


Many h5 pages have buttons to open/download immediately, such as Netease News

For example, Toutiao

There is such a button when opening the mobile terminal. After clicking, if the app is installed in the mobile phone, it will be opened directly. If it is not installed, it will jump to download. May I ask how this logic is implemented? As far as I know, js cannot judge whether app is installed on the mobile phone.

Ask experienced great gods to dispel doubts!

Thank you for your positive answer. The pit encountered now is that in safri of iphone, clicking will bring up a pop-up prompt asking me whether to open the app or telling me that the link is invalid, because the reason for this prompt leads to problems with the logic of setTimeout, so I wonder if you have any way to stop safri’s pop-up.

I didn’t expect so many people to pay attention to this problem.
Yesterday, a classmate also asked me in a private letter whether this problem had been solved.

It can’t be regarded as a perfect solution, but there are also some research experiences, so I wrote my summary of this problem in the following article, inside. Interested students are welcome to have a look. It’s all hard work! Please praise me! ! !

In the browser, arouse native app || jump to the application mall to download