7

Is there any way to intercept javascript triggered URL in a WebView just like normal hrefs using shouldOverrideUrlLoading()?

1 Answer 1

8

onLoadResource() is called when any resource is being called, including JavaScript. The purpose is a bit different though than shouldOverrideUrlLoading().

webControls.setWebViewClient(new WebViewClient() { //Notify the host application that the WebView will load //the resource specified by the given url. @Override public void onLoadResource (WebView view, String url) { super.onLoadResource(view, url); Log.v(TAG, "onLoadResource("+url+");"); } //Give the host application a chance to take over the //control when a new url is about to be loaded in the //current WebView. @Override public void shouldOverrideUrlLoading(WebView view, String url) { super.shouldOverrideUrlLoading(view, url); Log.v(TAG, "shouldOverrideUrlLoading("+url+");"); } } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.