Ionic Application Open Link in System Browser

I want to open the link in a system browser, for example, in ios in Safari and for android chrome (regardless of the default browser).

The problem is that the link does open in the system browser, but it also opens in the application. I want the link to open only in the system browser, and not inside the application.

this is my code.

<a ng-href="http://example.com/login/{{user._id}}" onclick="window.open(this.href, '_system', 'location=yes')" class="ion-home color-primary item"> Dashboard</a>

Keep in mind that im also passes id to my endpoint.

+4
source share
3 answers

to try

<a class="ion-home color-primary item" href="#" onclick="window.open('http://example.com/login/{{user._id}}', '_system', 'location=yes'); return false;"> Dashboard</a>
+9
source

InAppBrowser https://cordova.apache.org/docs/en/3.0.0/cordova/inappbrowser/inappbrowser.html

- , : fooobar.com/questions/56908/...

EDIT: , onclick, target="_system", event.preventDefault(); onclick

+4

(3.0) - .

<button ion-button block clear (click)="openWebpage(url)">Open Webpage</button>

openWebpage

 openWebpage(url: string) {
        const options: InAppBrowserOptions = {
          zoom: 'no'
        }

        // Opening a URL and returning an InAppBrowserObject
        const browser = this.inAppBrowser.create(url, '_self', options);

       // Inject scripts, css and more with browser.X
      }
0

Source: https://habr.com/ru/post/1629945/


All Articles