1

我有一个使用 OAuth 进行身份验证的应用程序,这意味着必须将用户定向到该网站才能授权该应用程序。我更愿意让用户明白他们正在使用标准浏览器在原始站点上进行授权,而不是仅仅使用 Web 视图来显示我的应用程序中的内容。但是,每次将它们定向到 Safari(通过 openURL)时,它都会启动一个新的 Safari 窗口,一旦 Safari 打开了 8 个窗口,它就根本无法工作。

我想知道 html 中锚标记的“目标”属性是否有等价物,这将允许我的应用程序中的所有 openURL 调用在同一个窗口中打开。

我可以通过 Web 应用程序公开其他功能,在 Safari 中创建原生 iphone 功能和 Web 应用程序功能之间的混合应用程序,但如果我每次在应用程序和 Safari 之间切换时都必须启动一个新窗口,它变得不可行. Youtube 应用程序显然能够在显示视频后将用户返回到上一页,但这很可能是 Safari 中用于 iphone 的自定义插件。此外,虽然返回上一页有些用处,但将它们发送到现有窗口中的新 URL 确实开辟了很多可能性。

4

2 回答 2

3

I'm pretty sure there is no way to pass a target parameter to openURL:.

What I noticed about Safari is that it won't open another tab if the page you are opening with openURL: is/was already open in Safari. It just reloads that page. This might sound trivial and not helpful but perhaps you could use it to your advantage if you can make your web application only use one page. Different views or states could be expressed with #anchor tags.

An example is http://m.flickr.com. Notice their URL structure? It goes http://m.flickr.com/#/home, http://m.flickr.com/#/explore/interesting/, http://m.flickr.com/#/search and so on. All of these are different web pages to the user but to Safari it's all the same page.

于 2009-10-31T02:39:46.213 回答
0

我发现 iOS 6.0.1 Safari 将打开带有简单标签的相同选项卡,没有斜线。因此,对于上面的示例http://m.flickr.com,到http://m.flickr.com#someinfo的 openURL 将打开到同一个选项卡。

在您的网页中,使用 window.location.hash 返回参数。在上面的示例中,它将返回#someinfo。

于 2013-06-21T00:41:06.447 回答