如何从iOS 7中的WebApp打开Safari [英] How to open Safari from a WebApp in iOS 7

查看:873
本文介绍了如何从iOS 7中的WebApp打开Safari的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以前版本的iOS中,< a> 标签会打开Mobile Safari,你必须拦截这些标签而不是留在webapp中(一个HTML页面,已由用户保存到主屏幕。

In previous versions of iOS, <a> tags would open Mobile Safari, and you had to intercept those to instead stay inside the webapp (an HTML page that has been saved to the home screen by the user).

从iOS 7开始,所有链接都保留在WebApp中。当我真的想要它时,我无法弄清楚如何让它打开Safari。

Starting in iOS 7, all links are staying inside the WebApp. I cannot figure out how to get it to open Safari, when I really want it to.

我尝试过使用 window.open 一个目标=_空白但不起作用。

I've tried using window.open and a target="_blank" but neither works.

这是一个示例。 https://s3.amazonaws.com/kaontest/testopen/index.html

如果您将其保存到iOS 6的主屏幕,该链接将打开Safari。但是在iOS 7中,它没有。

If you save that to your home screen in iOS 6, the link opens Safari. But in iOS 7, it doesn't.

请注意,这是每个人通常都会问的OPPOSITE问题(如何不打开Safari)。这种行为似乎是新的默认行为,我无法弄清楚如何恢复旧的行为!

Note that this is the OPPOSITE question that everyone is usually asking ("how to NOT open Safari"). That behavior seems to be the new default, and I can't figure out how to get the old behavior back!

推荐答案

拥有目标 _blank 的锚标记在iOS 7.0.3中可以使用,但是使用window.open将不起作用,并将在7.0.3的webview中保持打开状态:

Having an anchor tag with target _blankwill work in iOS 7.0.3 but using window.open will not work and will remain to open within the webview in 7.0.3:

window.open('http://www.google.com/', '_blank');

这篇关于如何从iOS 7中的WebApp打开Safari的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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