Catching an exception when trying to launch a URL service from within Safari on an iPhone
I was wondering if anyone knows - if I have an iPhone app that is registered with a URL service (e.g. alocola://), which means another app can invoke it by calling its URL - is there any way to embed this URL in an HTML page, and catch the exception if the app is not installed on the user's iPhone?
Or in other words / more details: I would like to write an app that conforms to some URL invocation (like alocola:// is doing), but would like this app to be launched from a web page read by mobile Safari. However, if the app is not installed on the user's iphone, I would like to be able to display a note saying "you must have the alocola app installed on your iPhone, please download it from the app store by clicking here". Is there a way (perhaps using javascript) to have Safari indicate开发者_如何学Python that the URL cannot be invoked, and catch this in order to display an intelligent message?
Thanks :-) Ariel
No, there's no way to detect this and display such a message. Instead, you should put text on the webpage saying that the using the link requires your app.
精彩评论