我正在进行设置,在该程序中,我在目标为'_blank'的InAppBrowser插件中打开了一个网址。插件Deeplinks也已安装和配置。
const browser: InAppBrowserObject = this.iab.create(url, '_blank', <InAppBrowserOptions>{
location: "no",
toolbar: "no",
footer: "no"
});
browser.on('loadstart').subscribe((event: InAppBrowserEvent) => {
console.log(event);
if (event.url.indexOf('wflwr://payment/success') > -1) {
browser.close();
}
if (event.url.indexOf('wflwr://payment/cancel') > -1) {
browser.close();
}
if (event.url.indexOf('wflwr://payment/error') > -1) {
browser.close();
}
});
我将其简化为仅显示重要部分。打开的网址是https://www.voan.ch/wfl/(这只是实际实现之前的模拟)
预期的行为是,单击URL上的每个链接,应用程序内的浏览器实例应关闭。这可以在iOS上正常运行,但不能在Android上运行。该事件只是不触发。如果我将其中一个网址更改为<a href="https://www.google.com">CANCEL</a>
,然后触发事件。
答案 0 :(得分:2)
对此的支持已在最新的pr
中添加要使用它,您将需要两件事:
例如,允许whatsapp自定义方案和Twitter
<preference name="AllowedSchemes" value="whatsapp,twitter" />`
inAppBrowserRef.addEventListener('customscheme', function (event) {
//do whatever you want here like:
window.open(event.url, "_system");
});