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?
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);
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.