I’m trying to intercept navigation within a WebView. The problem occurs when a link is clicked — the website runs JavaScript that causes the screen to go blank, even though I’m intercepting the navigation using shouldOverrideUrlLoading
, shouldInterceptRequest
, and other methods.
I’m certain it’s an issue with the specific website, as other sites do not exhibit this behavior. What confuses me is that iOS handles it correctly — using webNavigationAction
, it seems to block the navigation before the JavaScript executes, preventing the blank screen.
Is there any way to achieve similar behavior on Android? How can I prevent the JavaScript from running or the page from unloading, even when the navigation is intercepted?
** Reloading the original URL is not a viable workaround, as it causes the session to reset and important state (like login or form progress) is lost.