强制URL在Web Clip中打开(如果已安装)? [英] Force URL to open in a Web Clip if installed?

查看:313
本文介绍了强制URL在Web Clip中打开(如果已安装)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个Web应用程序,该Web应用程序通过自定义URL方案调用了本机应用程序,并且在本机应用程序完成其操作后,它通过打开回调URL返回到我的Web应用程序.

当我的Web应用程序在Safari中运行时,一切正常.但是,如果用户将Web应用程序保存到主屏幕(创建"Web剪辑")会怎样?在这种情况下,它在与常规野生动物园不同的过程中运行,并具有单独的cookie和缓存.

因此,当本机应用程序尝试返回到Web应用程序时,URL大概是由Safari打开的,而不是由Web Clip打开的,会话将丢失. (而不仅仅是会话-所有页面状态,在基于Javascript的丰富Web应用程序中,很多情况下启动时间都很短.)

这个假设正确吗?如果是这样,有没有解决的办法?如果安装了iOS,是否可以通过某种方式让iOS尝试使用网络剪辑打开URL?

解决方案

为了在iOS上通过自定义网址方案启动某些程序,您必须让应用程序通过内置在应用程序中的Info.plist来注册此信息. /p>

不可能有一个webapp/webclip在系统级别注册此信息.

因此,要回答您的主要问题,您不能这样做.

以下是

So when the native app tries to return to the web app, the URL will presumably get opened by Safari, not by the Web Clip, and the session will be lost. (And not just the session -- all the page state, which in a rich Javascript-based web app can be a lot of stuff with non-trivial startup time.)

Is this assumption correct? And if so, is there any way around it? Is there some way to get iOS to try to open the URL with a web clip if installed?

解决方案

In order to have something launch via a custom url scheme on iOS, you must have an application register this information via the Info.plist built into the app.

It is not possible to have a webapp/webclip register this information system-level.

So, to answer your main question, you cannot do this.

Here is the information on implementing custom URL schemes in native applications.

这篇关于强制URL在Web Clip中打开(如果已安装)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆