Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-14188

Callback to decide whether to open link or not.

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      Several times I've found myself wanting to tell inAppBrowser whether it can open a link in the embedded webview or using the system web browser. It would be great if there's a callback before loading a page (loadstart is too late there), where I can tell inAppBrowser to load the page or not.

      CB-14013 introduced AllowedSchemes, but excluded the use of http and https. It would be useful to allow intercepting http and https links, e.g. to decide whether to open the link in the system web browser or not. At first I thought this mechanism could be used, but because of the asynchronous nature of Cordova callbacks, this didn't work out, and I added a beforeload callback. See comment for an example.

      I've submitted a PR (my approach would be to generate a regexp based on AllowedSchemes and match the URL on that, instead of the current if logic).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                wvengen wvengen
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: