3

In Phonegap 3.x/Cordova 3.x: Is there any hook so we can check which link the user clicked on our webpage.

Background: We added Google Maps to our cordova app. The Google Map comes with a "(c) Google Inc." link which we are not allowed to remove oder modify. So when the user clicks on the "(c) Google Inc." link, the Google Maps disclaimer appears and the user has no way of getting back to our app in iOS. (On Android and Windows Phone there are hardware-back buttons, but not on iOS).

If we could hook into the URL opening event, we could intercept the call and open the link in an in-app-browser or in the system browser or something like that.

Any solution is welcome - whether as JavaScript, Phonegap Setting or Objective-C code. (Also C#/Windows Phone or Java/Android, but as mentioned, the problem on these two platforms is neglectable due the hardware back button).

PS: Maybe we can open EVERY link in an in app browser by a phonegap setting execpt links with a CSS class "internal" or something like that. In that case, we just would mark our links with the sayed class!?

Thank you!

schube
  • 652
  • 5
  • 18

1 Answers1

0

To open links in a separate browser app (e.g. Safari) see https://stackoverflow.com/a/18919588/11461 - I think this is the best way to perform what the user expects.

EDIT

Ah, sorry, I thought that was the outcome you wanted. In my code I intercept link clicks with $(document).on('click', 'a', function() { ...whatever... }); but I guess that won't work for the Google Maps copyright link?

A sneaky solution might be to create your own link (still going to the relevant Google page) and lay it over the top of the map in the same place. That way, any clicks in this corner will be under your control.

I'm afraid I do not know how to hook into browser calls which leave the confines of the app.

Community
  • 1
  • 1
Magnus Smith
  • 5,895
  • 7
  • 43
  • 64
  • 1
    Hi! Thank you, but that does not answer my question at all. The problem is to "intercept" a click on a link and decide how to open it. I am aware of the different options to open a link in a an in-app-browser, the system browser or just in the current window. – schube Feb 22 '14 at 21:14