[英]How to launch external opened app using custom URL scheme from Ionic App?
我想使用自定義 URL 方案從 ionic 應用程序 A 從外部啟動打開的應用程序 B。
嘗試過的解決方案
const target = '_system';
let url = 'abc123://abc.com/mobile/details/' + Id;
const options: InAppBrowserOptions = {
zoom: 'no',
location: 'no',
hidden: 'yes'
};
this.loadingProvider.dismiss();
this.inAppBrowserRef = this.inAppBrowser.create(url, target, options);
我在模板中使用錨標記,並設置target="_blank"
。 這是來自 Ionic 5 應用程序,但我只在完整的 iOS 版本中進行了測試,我還沒有 Android 版本。 我也在使用電容器,但我認為這不會改變瀏覽器的行為。
<a [href]="website" target="_blank">{{ website }}</a>
target="_blank"
導致它在主操作系統瀏覽器中打開 URL。 然后主瀏覽器應該處理您的自定義鏈接。
如果您有自定義 URL 可以打開使用
window.open('Your URL','_system');
在你的代碼中。 這可以在 Android 和 ios 平台上完美運行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.