Reputation: 1768
How can I make sure that all links in the webview component in an app-inventor program always opens as a new window? ie, using "full browser".
I checked the FollowLinks option but that just opens the links within the webview only. Unchecking that option disables all links inside webview.
Also, the hyperlink displayed inside the webview has the target="_blank"
attribute set.
Upvotes: 1
Views: 2814
Reputation: 6293
unfortunately this is not possible with the webview in App Inventor, however you could use the activity starter to start a browser instead Taifun
Upvotes: 2
Reputation: 1414
You can do this by extending the WebViewClient
and overloading the shouldOverrideUrlLoading
method. This method gets called whenever you click a link within the webview.
In your overload method you will generate an intent to open the browser and start an activity with this intent. Finally you use the setWebViewClient
method on your webview and pass your extended WebViewClient
as a parameter.
I have some example code within a project on github. In line 115 the WebViewClient
is set. In this example only special links will be loaded in external browser. The intent for that is generated in line 130.
Upvotes: 1