如何使用Capacitor Browser API在浏览器中访问url


I have a working code as such 
this.paymentApiService.createPaymentMethod(paymentMethodDto)
.subscribe((payment) => {
this.paymentForm = null;
if (payment.url) {
this.paymentForm = null;
console.log('Loading dismissed!');
loading.onDidDismiss();
const abcd = this.inAppBrowser.create(payment.url, '_blank');
abcd.on('loadstop').subscribe((event) => {
if (event.url.includes('/credit-card/wait')) {
abcd.close();
this.modalController.dismiss();
this.router.navigate(['credit-card/wait']);
} else if (event.url.includes('/credit-card/failure')) {
abcd.close();
this.modalController.dismiss();
this.router.navigate(['credit-card/failure']);
}
});

但是最近支付url提供程序已经阻止了内联访问,所以我不能使用inApp浏览器来完成这个过程,所以我决定尝试从电容器的浏览器Api,但我不确定如何通过事件处理程序访问url具体来说,我想写这个

abcd.on('loadstop').subscribe((event) => {
if (event.url.includes('/credit-card/wait')) {
abcd.close();

但是使用浏览器api,我无法访问事件(未定义完成)

Browser.open({ url: payment.url });

Browser.addListener("browserFinished"(完成)=比;{Console.log ("这是url在完成"+完成)})

Browser.addListener('browserPageLoaded',(finished: any) =>  {
console.log("thisi is url at page loaded" +    finished )
})

任何建议如何检查浏览器url是否重定向到特定点?

Capacitor's Browser插件在iOS上使用Safari视图控制器,在Android上使用Chrome自定义标签,这些组件都不提供加载的url,所以插件也不能提供。

最新更新