title: How to capture link page loads in a WebView?
body: <p>I want to apply custom JS code when webpage loads in Android's <code>WebView</code>. I have a <code>WebView</code> with custom <code>WebViewClient</code>, overriding <code>onPageFinished()</code> and I apply the JS code there using </p>
  
  <pre><code> webView.loadUrl("javascript:(function() { ... });");
  </code></pre>
  
  <p>which works nicely. However, there are some pages where upon clicking the link, the page is loaded "dynamically" (Using AJAX?) and the <code>onPageFinished()</code> is not called so our custom JS code is not applied.</p>
  
  <p>An example of such a page is <a href="https://www.reddit.com/r/Nature" rel="nofollow noreferrer">https://reddit.com/r/Nature</a> (you need to use Chrome developer tools and set the mobile view), where threads are loaded dynamically upon clicking them.</p>
  
  <p>How can I detect those page loads? </p>