How to Open External link in ionic app

2019-03-20 15:36发布

Anyone have a idea about how to open external link(outside from my ionic app) in my ionic app. when i tab on the link it will show my app if exsist in mobile.

enter image description here

5条回答
Rolldiameter
2楼-- · 2019-03-20 16:14

You can Install the Cordova and Ionic Native plugins: Browser Tab.

ionic cordova plugin add cordova-plugin-browsertab
npm install --save @ionic-native/browser-tab

and

import { BrowserTab } from '@ionic-native/browser-tab';

constructor(private browserTab: BrowserTab) {

  browserTab.isAvailable()
  .then(isAvailable => {
  if (isAvailable) {
    browserTab.openUrl('https://ionic.io');
  } else {
    // open URL with InAppBrowser instead or SafariViewController
  }
 });
}

look here

查看更多
一纸荒年 Trace。
3楼-- · 2019-03-20 16:21

As described here https://ionicframework.com/docs/native/in-app-browser/:

Install the Cordova and Ionic Native plugins:

$ ionic cordova plugin add cordova-plugin-inappbrowser
$ npm install --save @ionic-native/in-app-browser

Usage

constructor(private iab: InAppBrowser) { }
const browser = this.iab.create('https://ionicframework.com/');
// browser.show(), browser.close()
查看更多
一纸荒年 Trace。
4楼-- · 2019-03-20 16:31

For opening a link with your app, you can use the custom-url-scheme cordova plugin . This enables you to open your app with an external link like testapp://path?foo=bar . Here is the link https://github.com/EddyVerbruggen/Custom-URL-scheme

查看更多
叼着烟拽天下
5楼-- · 2019-03-20 16:35

Install InAppBrowser:

ionic cordova plugin add cordova-plugin-inappbrowser

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

Call your links like this:

window.open(url, '_system');
查看更多
趁早两清
6楼-- · 2019-03-20 16:35

Install in App browser .

cordova plugin add cordova-plugin-inappbrowser

Use window.open for this

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

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

查看更多
登录 后发表回答