Launch mobile Safari from UIWebView * without * changing application source?

I am developing a small site that will only appear in the application inside the UIWebView, and one page has several links to an external website. I would like them to open in mobile Safari, but all the links inside the application download are in web view. Changing the source of the application is not an option, as the site must be active before any changes are made.

Is there a way to make the link inside UIWebView launch Mobile Safari using HTML / 5 or Javascript? Mimic shouldStartLoadWithRequest? Hidden, hacked workarounds or brilliant alternatives?

(And out of sheer curiosity ... why not?)

+3
source share
2 answers

It would be a poor design to allow sites to access iPhone frameworks via simple HTML. This will open all sorts of security holes. This is not the web behavior you want to change, so I think you might need to change the source of the application. I still do not understand why this is not an option. Could you go deeper?

+1
source

One option is to add a custom URL handler. Your website can then determine if the β€œbrowser” is the application and serves custom URLs for the links that you would like to support (aka open) in your application. Then, any standard HTTP / s URLs will open in Mobile Safari.

, - URL-, myappurl:// , , http://, Mobile Safari.

0

Source: https://habr.com/ru/post/1780806/


All Articles