I am new in Android and I am trying to open a Link in webview using this code
WebView myWebView = (WebView) findViewById(R.id.webinfo); myWebView.loadUrl("http://oslobokfestival.netteam.no/artical.php?articalid=93"); myWebView.setBackgroundResource(R.drawable.lbg); myWebView.setBackgroundColor(Color.TRANSPARENT); myWebView.getSettings().setJavaScriptEnabled(true);
and in this HTML page contains some links and I want that when user click that link should be open in same webview, at this point its opening in mobile browser, please give me appropriate solution.. Thanks.
Within the shouldOverrideUrlLoading() method simply get the URL from the request and pass into the Intent. See the full example.
JavaScript is disabled in a WebView by default. You can enable it through the WebSettings attached to your WebView . You can retrieve WebSettings with getSettings() , then enable JavaScript with setJavaScriptEnabled() . WebView myWebView = (WebView) findViewById(R.
You need to add WebViewClient to your WebView in order to open it in the WebView. Something like
myWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { view.loadUrl(request.getUrl().toString()); return false; } });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With