search

Home  >  Q&A  >  body text

javascript - There is a problem with loading native apps from web pages that are compatible with Android and ios. Is using iframe invalid in Safari on ios?

Just like the title, a requirement from the company requires that if the app is installed on the mobile phone, it will be redirected to the specified page. If the app is not installed, it will jump to the download page. After searching for the code on the Internet, after testing, a problem was discovered.

Generally speaking, there are two methods:

The first is iframe: The problem encountered is to call up the app by hiding an iframe, and the page will jump after a few seconds. This is possible on Android, but the test on ios has no effect, and it has never been called. Calling sms:// tel:// will not work; test machine iphone6, system 10.0.2;

The second method is to use the href attribute of the a tag to jump. If the app has been installed, it can be used on both Android and ios. However, if the app is not installed, the web page will report an invalid URL error on ios. This is the product It's not allowed there.

I would like to ask someone from the sf forum to give me some advice on the correct way to launch the app, thank you.

Another way is

<a href="itms://itunes.apple.com/app/id452186370">百度地图</a>

This should be said to be very good, but it is a little inconsistent with my needs. Our requirement here is to jump to the specified page of the app instead of simply calling it up.

伊谢尔伦伊谢尔伦2755 days ago466

reply all(1)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 13:33:40

    On iOS, first the app must register its own URL Schemes, which means declaring a special prefix to replace http, such as abc. You check whether it is iOS on the web page. If so, replace http with abc, and then open the link. . If it is https, change it to abc.

    reply
    0
  • Cancelreply