Skip to content

Android: fix firing urlRequest event for SPA navigations - #948

Open
strumasoft wants to merge 1 commit into
coronalabs:masterfrom
strumasoft:android-webview-history-urlrequest
Open

strumasoft wants to merge 1 commit into
coronalabs:masterfrom
strumasoft:android-webview-history-urlrequest

Conversation

@strumasoft

@strumasoft strumasoft commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Android: Override shouldOverrideUrlLoading to handle history and SPA navigations for urlRequest event

History

urlRequest event handlers are not fired as described in web view documentation https://docs.coronalabs.com/api/library/native/newWebView.html when history.pushState, history.replaceState, hash changes (#section), or single-page-app (SPA) navigations/routing is used.

Solution

The existing code only implements shouldOverrideUrlLoading(WebView, String), but from API 24, WebView calls shouldOverrideUrlLoading(WebView, WebResourceRequest) instead, which just forwards to the old one, but now SPA navigations/routings are correctly fired as urlRequest events

@strumasoft strumasoft changed the title Android: Override shouldOverrideUrlLoading to handle history and SPA navigations for urlRequest event Android webview history urlRequest Sep 27, 2026
@strumasoft strumasoft changed the title Android webview history urlRequest Android: fix firing urlRequest event for SPA navigations Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant