问题描述
我有一个设置,我在插件 InAppBrowser 中打开一个带有目标_blank"的 url.插件 Deeplinks 也已安装和配置.
I am having a setup, where I open a url in the plugin InAppBrowser with target '_blank'. The plugin Deeplinks is also installed and configured.
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/(它是在真正实现之前只是一个 Mock)
I shortened it to show just the important parts. The url which is opened is https://www.voan.ch/wfl/ (it is just a Mock before the real implementation)
预期的行为是,单击 url 上的每个链接时,应用程序内的浏览器实例应该关闭.这在 iOS 上按预期工作,但在 Android 上却不行.事件只是没有被触发.如果我将其中一个网址更改为例如<a href="https://www.google.com">CANCEL</a>,然后触发事件.
The expected behaviour is, that on a click on each of the links on the url, the browser instance inside the app should close. This works as intended on iOS, but not on Android. The event is just not triggered. If I change one of the urls to e.g. <a href="https://www.google.com">CANCEL</a>, then the Event gets triggered.
推荐答案
在最新的 pr
要使用它,您需要两件事:
to use it you will need 2 things:
例如允许 whatsapp 自定义方案和 twitter
for example to allow whatsapp custom scheme and twitter
- 使用您想要支持的自定义方案添加新的 config.xml 首选项:<代码><preference name="AllowedSchemes" value="whatsapp,twitter"/>`
- 添加事件监听器customscheme:<代码>inAppBrowserRef.addEventListener('customscheme', function (event) {//在这里做任何你想做的事情:window.open(event.url, "_system");});
这篇关于Android 上的 Ionic InAppBrowser 无法导航到自定义 URL 方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)