Before starting working on MOBILE-4018, I looked if it was possible to replicate in iOS the behaviour of onOverrideUrlLoading from our prevent-override plugin. That way the logic would be more consistent between iOS and Android, we wouldn't need to injectÂ
iframe-treat-links.js to all iframes.
I did some tests with shouldOverrideLoadWithRequest, but that function is called when URLs are loaded in iframes too, while the Android function is only called if the URL is loaded in the main WebView. And we don't want to block page loads in iframes, only in the main WebView.
Right now the shouldOverrideLoadWithRequest function doesn't receive the information needed to determine if the URL is loaded in the main iframe or not: it only receives the request and the navigationType. The function decidePolicyForNavigationAction used by Cordova has the information we want (navigationAction.sourceFrame.mainFrame), but it's not passed to shouldOverrideLoadWithRequest and we cannot override that function.
However, the Cordova team is working on changing this in cordova-ios 8 and pass all the information to shouldOverrideLoadWithRequest. Here's the related code. With this change we should be able to modify our prevent-override plugin to handle this case and provide a behaviour similar to Android's onOverrideUrlLoading.