I have a Meteor (v 1.2.0.2) angular mobile app and need to have a link to an external webpage but the links would not open on android or ios. After researching, I found from this question that I could add a cordova plugin called inAppBrowser
How to get links to open in the native browser in iOS Meteor apps?
I used this from one of the answers to add the inAppBrowser plugin
meteor add cordova:cordova-plugin-inappbrowser@https://github.com/apache/cordova-plugin-inappbrowser/tarball/bc9036d90a1f3f2220b5fc29b77cf2405e7fd781
After that my link worked on my android but not on my ipad.
Here is my html
<a ng-click="adClick(pageAd.link, pageAd._id)">
<img ng-src="/images/ads/{{pageAd.src}}" alt="{{pageAd.alt}}" />
</a>
and the function in my controller
$scope.adClick = function(url, adId)
{
$meteor.call("incrementAdCount", adId).then(
function(data){
window.open(url, "_system");
},
function(error) {
}
);
}
On the ipad my ad count method works every time that I click, but the window.open does not seem to do anything. On android it all works.
Is there any additional setup I need to do for inAppBrowser in meteor for the ios link to work? I feel like it should be simple but after hours of searching I can find almost nothing on this for meteor, so maybe I'm looking in the wrong places.
I also tried using the angular $window.open, which also worked on android but not ios.
I decided to research the cordova plugin since I was finding little to help when searching for meteor. In the cordova inAppBrowser plugin readme I found this:
"If you want all page loads in your app to go through the InAppBrowser, you can simply hook window.open
during initialization. For example:"
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
window.open = cordova.InAppBrowser.open;
}
But anywhere I use the cordova variable in my meteor project, it is undefined. Is this even available in Meteor? And If I needed to do that why did it work in android without doing it?
My main question is what else do I need to do to open a link in a mobile ios app?