Search code examples
androidcrosswalk

shouldOverrideUrlLoading not being called in XWalkView / XWalkResourceClient


I'm trying to track what links my users click in the browser and failing miserably:

My code:

browser = new XWalkView(getMainActivity());
browser.setResourceClient(new XWalkResourceClient(browser)
{
  @Override
  public boolean shouldOverrideUrlLoading(XWalkView view, String url)
  {
    log.i("juhu 1", url);
    return false;
  }
});

This only calls the callback for URLs that I give it (browser.load()), but not for URLs that user then clicks on the rendered page. What's worse, it's not consistent: sometimes the callback gets called, sometimes not.

Here's an example that fails:

<html>
  <body>
    <p><a href="#mylink">my link 1</a></p>
    <p><a href="mylink">my link 2</a></p>
  </body>
</html>

I tried this with XWalk 15.44.384.13 (latest) and 14.43.343.24 (a couple revisions back), both with no success.

I looked all over the place for similar methods, but neither resource client nor ui client seem to provide something that would work.


Solution

  • This looks fixed as of at least XWalk 16.45.421.19 with the call being made as expected.