Safari并定位到特定窗口吗

Safari并定位到特定窗口吗

本文介绍了可以打开iPhone Safari并定位到特定窗口吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have an app that uses OAuth to authenticate, which means the user must be directed to the website to authorize the application. I prefer to make it obvious to the user that they are using a standard browser to authorize at the original site rather than just using a web view to show the content within my app. However, every time they are directed to Safari (via openURL), it launches a new Safari window and once Safari has 8 windows open, it simply fails to work at all.

我想知道html中的锚标记的"target"属性是否等效,这将允许我使应用程序中的所有openURL调用在同一窗口中打开.

I'm wondering if there is an equivalen to the "target" attribute of an anchor tag in html which would allow me to cause all openURL calls from my application to open in the same window.

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

There is other functionality that I can expose via the web application, creating a hybrid app between native iphone functionality and web app functionality in Safari, but if I have to launch a new window every time I switch between the app and Safari, it becomes unworkable. The Youtube app is obviously able to return the user to the previous page after showing a video, but that might well be a custom plugin in Safari for iphone. Also, while returning to the previous page is somewhat useful, sending them to a new URL in the existing window really opens up a lot of possiblities.

推荐答案

我很确定没有办法将目标参数传递给openURL:.

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

我注意到有关Safari的问题是,如果您正在使用openURL:打开的页面已经/已经在Safari中打开,它将不会打开另一个选项卡.它只是重新加载该页面.这听起来很琐碎且无济于事,但是如果您可以让您的Web应用程序仅使用一页,那么也许可以利用它来发挥自己的优势. #anchor标签可以表示不同的视图或状态.

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.

例如 http://m.flickr.com .注意到他们的网址结构了吗? http://m.flickr.com/#/home http://m.flickr.com/#/explore/interesting/ http://m.flickr.com/#/search 等.对于用户而言,所有这些都是不同的网页,但对于Safari而言,它们都是相同的页面.

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.

这篇关于可以打开iPhone Safari并定位到特定窗口吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 05:48