How to open external links from my Ionic app inside a web browser view

为君一笑 提交于 2019-12-05 12:00:58

Use it In App Browser Ionic Native plugin

Install the Cordova and Ionic Native plugins:

ionic cordova plugin add cordova-plugin-inappbrowser

npm install --save @ionic-native/in-app-browser

In app.module.ts add InAppBrowser Provider

import { InAppBrowser } from '@ionic-native/in-app-browser';

providers: [
  InAppBrowser,
]

Html:

 <ion-buttons>
    <button ion-button (click)="redirect()"> GO » <button>
 <ion-buttons>

In ts:

import { InAppBrowser } from '@ionic-native/in-app-browser';


 constructor(private inAppBrowser: InAppBrowser) {}

redirect() {
 this.inAppBrowser.create("https://www.w3schools.com/php/");
}

you can also see this video tutorial

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!