Search code examples
androidioscordovacordova-plugins

What is the Equivalent of Android's CordovaPlugin remapUri Override for iOS Cordova Plugins


I need to alter the URL that the Cordova WebView loads on launch programatically. On Android, I see that I can override remapUri using the CordovaPlugin interface. However, I do not see a similar or equivalent method for iOS Plugins. Does anyone know how to accomplish something similar on iOS?

Many Thanks, Lyle


Solution

  • Though a little bit late. But yes, there is.

    You can intercept urls via overriding

    - (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
    

    in your custom plugin. Return Yes when you'd like to handle the url yourself.

    Check out https://github.com/joyxuLogic/cordova-plugin-iframelinks/blob/master/src/ios/IFrameLinks.m