0

I have a XWalkView in my andoid app that is used to display a single page, this page has a lot of popup ads and my goal is to prevent the XWalkView from navigating to other pages than the one I set it to. In the UWP version of my app I wrote:

private void webView_NewWindowRequested(WebView sender, WebViewNewWindowRequestedEventArgs args)
{
    args.Handled = true;
}

and that solved that. Is there any similar way to do this with XWalkView? Or any way at all?

Netråm
  • 453
  • 6
  • 12

1 Answers1

0

If you override shouldOverrideUrlLoading, you can return true to indicate that the request has been handled.

xwalkview.setResourceClient(new XWalkResourceClient(xwalkview) {
    @Override
    public boolean shouldOverrideUrlLoading(XWalkView view, String url) {
        return !url.equals(MY_URL);
    }
});
user650881
  • 2,214
  • 19
  • 31