Okay… I just had someone here school me on how this really works.
If you are using a WebPopup, then you override the URL request by returning false.
If you are using a WebView, then you can only override the request by calling the stop() function. The Lua listener does not accept a return value. The reason the WebView’s Lua listener has a different behavior is because it is also used to provide other events such as a “loaded” event to let you know when the page has finished loading.
Regarding calling stop() on Android still displaying an error page, this is exactly the behavior that I expected and what I was warning you about up above. What you’re trying to do will only work on iOS. Unfortunately, I don’t think there is a good solution on Android. The problem with Google’s WebView is that we can’t reliably catch the URL request until the request has already been sent. This means that is already too late to stop it. The best we can do is block the response when you return false for a WebPopup or call stop() on a WebView. Now, this works fine when the URL is to a real web page, but for an invalid URL to a web page, you’ll always get an error page displayed. This is an unfortunate quirk with Google’s WebView. While it’s fair to call it a bug, it’s unfortunately a bug that we’re stuck with and I don’t a reliable resolution to.
Now, let me ask you this. Are you using the WebView to display a local HTML file as a means of display a nice GUI to the end-user?
That is, you’re WebView is not intended to “navigate” to other web pages on the Internet? If so, then it sounds like what you need is a new API that allows you to display an HtmlView which does not support any navigation at all. That is something we can definitely implement reliably on all platforms because we can block all navigation, but still provide feedback of what was tapped on. I’m just trying to think outside of the box here of what might be a good solution to this problem. If this is what you’re after, then I can write it up as a feature request.