javascript - H5 wake up App
我想大声告诉你
我想大声告诉你 2017-05-16 13:34:27
0
1
610

H5 wakes up the App, how to detect whether it is successfully woken up?

The current processing is:

  • After clicking, it will jump to the download page after 500ms without success.

  • Under ios, after clicking, the App is opened directly; but the page continues to execute, and it will jump to the download page regardless of whether the App is installed or not.

  • The requirement is that if the App is successfully opened, it cannot jump to the download page.

The current idea is to determine whether the App is open by judging whether the page is visible or loses focus, so we made the following attempts:

  • Judge document.hasFocus(), but its return value is always true.

  • Listen to the visibilitychange event; visibilitychange is available on Android. On iOS, it will only be triggered when switching pages in the browser. Clicking the home button to return to the desktop will not trigger.

  • Listen to the pageshow event, which seems to be triggered only when the page is reloaded, which cannot meet the needs.

我想大声告诉你
我想大声告诉你

reply all(1)
仅有的幸福

Use Universal Links on iOS.

setTimeout visibilityChange is all a hack. There is an official solution like universal links in iOS9+, but all kinds of weird browsers on Android are in trouble. If you still jump to the download page after calling up your own App, then just jump. What can be done? Instead of overly focusing on the details that cannot be solved by the front end and can only be hacked, it is better to make the product good. Once the user installs your app, he will naturally use the app himself.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template