Tuesday, 4 December 2018

How to capture AJAX page loads in a WebView?

I want to apply custom JS code when webpage loads. I have a WebView with custom WebViewClient, overriding onPageFinished() and I apply the JS code there using

 webView.loadUrl("javascript:(function() { ... });");

which works nicely. However, there are some pages where upon clicking the link, the page is loaded "dynamically" (Using AJAX?) and the onPageFinished() is not called so our custom JS code is not applied.

How can I detect those page loads?

An example of such a page is https://reddit.com/r/Nature (you need to use Chrome developer tools and set the mobile view), where threads are loaded dynamically upon clicking them.



from How to capture AJAX page loads in a WebView?

No comments:

Post a Comment