Rik Rik - 1 year ago 92
HTML Question

Ionic hrefs not opening in Android

I have been working on an app that uses JSON data from a server. In this JSON data there is an object that is made up of HTML, which often has an URL in it. And I also have an object that is 'just' an URL which I load into a button which should open the URL when clicked. The problem is, however, that when I click the URL's in the Ionic View app the URL's will open inside the app itself. But when I click the URL's in the standalone build on Android both these URL's don't work. What I try to accomplish is that both these URL's open in the system browser when clicked. But I can't seem to find out why this doesn't work

I do have the Cordova script in my index.html, and I also have the InAppBrowser plugin installed from Cordova.

This is the button:

<a class="button button-full button-assertive" ng-model="button" ng-click="openUrl({{vacature.url}})"> Sollicitatielink </a>

This is the function in my controllers.js:

$scope.openUrl = function(url) {

window.open(url, '_system', 'location=yes');


This is the HTML in the JSON data:

<a href="url_here" target="_blank">via our website.</a>

I was wondering if you guys could help me with why this doesn't work. Could it be that I did not implement the plugin correctly, and if so, how could I do this properly?

Thanks in advance!

Rik Rik
Answer Source

I figured out why my URL's were not opening when clicking the button. This is the code I now use for it to work properly.

This is the button:

<button class="button button-full button-assertive" ng-click="openUrl('{{vacature.url}}')"> Sollicitatielink </button>

This is the function:

$scope.openUrl = function(extUrl) {


    window.open(extUrl, '_system');


When I find out how I can make sure the URL's in the HTML in the JSON data are working I will edit this post

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download