Synchronizing Software and Services

Working hours : Mon-sat (9.00am - 6.00PM)

+(91) 011 41735 050
contact@syncsas.com

Android Native App – Open External Link in Webview

Android Native App – Open External Link in Webview 12 Sep

If you want to deliver a web application (or just a web page) as a part of a client application, you can do it using WebView. The WebView class is an extension of Android’s View class that allows you to display web pages as a part of your activity layout. It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page.

I am using a WebView in my code and it displays some HTML email message, the message might contain some links in it. If I click on the link, the WebView navigates to that link. I want to prevent this behavior and want to enforce all links in the WebView to open in the default browser. I want to do this for Android and iOS.
I found some sample on developers.android and it suggests to make use of shouldOverrideUrlLoading() method.

A common scenario in which using WebView is helpful is when you want to provide information in your app that you might need to update, such as an end-user agreement or a user guide. Within your Android app, you can create an Activity that contains a WebView, then use that to display your document that’s hosted online.

Leave a Reply

Your email address will not be published.