Android / iOS, open the browser with javascript from a WebView


Hi, I would like a suggestion, I try to open the browser from a page that is loaded from WebView / UIWebView , in an application iOS or Android for example:

For security in the new OS this can be a problem in terms of security, but I would like a suggestion from the experts, any possible solution?

Some way to open a url from Webview , no matter if I require the use of some Framework , the use of a Intent or interface is discarded.

asked by Elenasys 29.01.2016 в 19:38

2 answers


I use cordova for development in android and I open windows with this code:"URL_A_ABRIR", { openExternal:true });

But it seems that this method only works on Android and not on iOS. For iOS there is a cordova plugin called ChildBrowser that works similarly although the notation is a bit different:

window.plugins.childBrowser.showWebPage('URL_A_ABRIR', { showLocationBar: true });    

But again, this is using the cordova platform. I do not know how it would be integrated natively (the android method should work, but I'm not so sure about iOS).

answered by 30.01.2016 / 02:38

I'll answer for native iOS.

Treat your links in HTML as you see fit, opening them from Javascript or with a hyperlink:

<a href="">mi enlace</a>

The only thing you have to do with your UIWebView is to intercept that link in the delegate and launch it in the native browser.

- (BOOL)webView:(UIWebView *)webView 
shouldStartLoadWithRequest:(NSURLRequest *)request 

      [[UIApplication sharedApplication] openURL:request.URL];
      return NO;

answered by 13.10.2016 в 10:52