Chris
Chris

Reputation: 435

Ionic click/tap events not firing for external URLs

We recently updated an Ionic v1 app (1.7.15 to be precise) and as of some point between the app last being updated (a year or two ago) and now, we're no longer able to use click events to open external URLs on mobile devices, although they're still working fine in the web version served by Ionic.

We were using this format before:

<a href="#" onclick="window.open('http://www.google.com', '_system', 'location=yes');">Google</a>

But this has stopped working, presumably because the touch events are no longer being picked up by onclick.

I've tried the ng-click directive instead:

<a href="#" ng-click="window.open('http://www.google.com', '_system', 'location=yes');">Google</a>

But nothing happens. Nothing at all. Not even a console error.

I've also tried using the on-tap event:

<a href="#" on-tap="window.open('http://www.google.com', '_system', 'location=yes');">Google</a>

But when I do this, Ionic is strangely inserting a "disable-user-behavior" class into each element, which (as far as I can tell) is disabling our events. So that's not working either.

So what is now the best way to handle click/tap events and open the external URLs in Ionic v1? I'm aware that the inline script is ugly as hell.

Upvotes: 0

Views: 441

Answers (1)

Sach
Sach

Reputation: 69

you can install following plugin cordova plugin add cordova-plugin-inappbrowser

https://www.google.com/', '_system', 'location=yes');" >Google

Refer this link http://intown.biz/2014/03/30/cordova-ionic-links-in-browser/

Upvotes: 1

Related Questions