尝试从 iPhone 上的 Safari 中启动 URL 服务时捕获异常
我想知道是否有人知道 - 如果我有一个 iPhone 应用程序注册了 URL 服务(例如 alocola://),这意味着另一个应用程序可以通过调用它的 URL 来调用它 - 有什么方法可以将此 URL 嵌入到HTML 页面,如果应用程序未安装在用户的 iPhone 上,则捕获异常?
或者换句话说/更多细节: 我想编写一个符合某些 URL 调用的应用程序(就像 alocola:// 正在做的那样),但希望从移动 Safari 读取的网页启动此应用程序。但是,如果用户的 iPhone 上未安装该应用程序,我希望能够显示一条注释,说明“您的 iPhone 上必须安装 alocola 应用程序,请单击此处从应用程序商店下载它”。有没有办法(也许使用 javascript)让 Safari 指示无法调用该 URL,并捕获此信息以显示智能消息?
谢谢 :-) 爱丽儿
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 that the URL cannot be invoked, and catch this in order to display an intelligent message?
Thanks :-)
Ariel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,没有办法检测到这一点并显示这样的消息。相反,您应该在网页上添加文本,说明使用该链接需要您的应用程序。
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.