WebViewJavascriptBridge (and similar libraries) rely on loading a custom URL scheme in an iframe and intercepting the request in shouldStartLoadWithRequest
. Other approaches include embedded WebSockets and HTTP servers (see LinkedIn.
One alternative to consider is modifying document.cookie
for some magic cookie name value, and then listening for those changes on the iOS side via NSHTTPCookieManagerCookiesChangedNotification
. That might have fewer side-effects that triggering a (sub-)frame load.