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']);
}
});
But recently the payment url provider has blocked inline access , so i am not able to use inApp browser to complete the process, so i decided to try Browser Api from capacitor, but im not sure how to access the url through event handler
to be specific i want to do this
abcd.on('loadstop').subscribe((event) => {
if (event.url.includes('/credit-card/wait')) {
abcd.close();
But using Browser api, im not able to access the event (finished is undefined)
Browser.open({ url: payment.url });
Browser.addListener('browserFinished',(finished) => {
console.log("thisi is url at finish" + finished )
})
Browser.addListener('browserPageLoaded',(finished: any) => {
console.log("thisi is url at page loaded" + finished )
})
Any suggestion how to check if the browser url is redirect to a specific point?
question from:
https://stackoverflow.com/questions/65831473/how-to-use-the-capacitor-browser-api-to-access-url-in-the-browser 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…