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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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
回答2:
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');
回答3:
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()
回答4:
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
回答5:
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/
标签:
ionic-framework