javascriptiosweb-applicationssafarimobile-safari

How to open Safari from a WebApp in iOS 7


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).

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.

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

Here is a sample. https://s3.amazonaws.com/kaontest/testopen/index.html

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

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!


Solution

  • 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');