如何在应用浏览器中隐藏位置 url
How to hide inappbrowser location url
大家好,我正在尝试将支付网关集成到我的离子应用程序中,代码运行良好,但我唯一的问题是如何隐藏 inAppBrowser 位置 URL
打开方式是这样
我希望它在没有 URL 栏的情况下这样打开
这是下面的代码。谢谢
constructor(
private rave: Rave,
private ravePayment: RavePayment,
private misc: Misc,
private iab: InAppBrowser,
) { }
...
this.rave.init(PRODUCTION_FLAG, "YOUR_PUBLIC_KEY")
.then(_ => {
var paymentObject = this.ravePayment.create({
customer_email: "nuser@example.com",
amount: 2000,
customer_phone: "23412345667",
currency: "NGN",
txref: "rave-1234567",
meta: [{
metaname: "flightID",
metavalue: "AP1234"
}]
})
this.rave.preRender(paymentObject)
.then(secure_link => {
secure_link = secure_link +" ";
const browser: InAppBrowserObject = this.rave.render(secure_link, this.iab);
browser.on("loadstop")
.subscribe((event: InAppBrowserEvent) => {
if(event.url.indexOf('https://your-redirect-url') != -1) {
if(this.rave.paymentStatus(url) == 'failed') {
this.alertCtrl.create({
title: "Message",
message: "Oops! Transaction failed"
}).present();
}else {
this.alertCtrl.create({
title: "Message",
message: "Transaction successful"
}).present();
}
browser.close()
}
})
}).catch(error => {
// Error or invalid paymentObject passed in
})
})
对于 Cordova 在 App Browser 中,您可以使用 location
作为 no
传递选项对象
var ref = cordova.InAppBrowser.open(url, target, options);
您的代码将变成
this.rave.render(secure_link, this.iab,{location: 'no'})
编辑 -
尝试创建一个iab对象,然后将其传递给this.rave.render
let browser = this.theInAppBrowser.create(secure_link, _blank,{location: 'no'});
然后这样传下去
this.rave.render(secure_link, browser)
大家好,我正在尝试将支付网关集成到我的离子应用程序中,代码运行良好,但我唯一的问题是如何隐藏 inAppBrowser 位置 URL
打开方式是这样
我希望它在没有 URL 栏的情况下这样打开
这是下面的代码。谢谢
constructor(
private rave: Rave,
private ravePayment: RavePayment,
private misc: Misc,
private iab: InAppBrowser,
) { }
...
this.rave.init(PRODUCTION_FLAG, "YOUR_PUBLIC_KEY")
.then(_ => {
var paymentObject = this.ravePayment.create({
customer_email: "nuser@example.com",
amount: 2000,
customer_phone: "23412345667",
currency: "NGN",
txref: "rave-1234567",
meta: [{
metaname: "flightID",
metavalue: "AP1234"
}]
})
this.rave.preRender(paymentObject)
.then(secure_link => {
secure_link = secure_link +" ";
const browser: InAppBrowserObject = this.rave.render(secure_link, this.iab);
browser.on("loadstop")
.subscribe((event: InAppBrowserEvent) => {
if(event.url.indexOf('https://your-redirect-url') != -1) {
if(this.rave.paymentStatus(url) == 'failed') {
this.alertCtrl.create({
title: "Message",
message: "Oops! Transaction failed"
}).present();
}else {
this.alertCtrl.create({
title: "Message",
message: "Transaction successful"
}).present();
}
browser.close()
}
})
}).catch(error => {
// Error or invalid paymentObject passed in
})
})
对于 Cordova 在 App Browser 中,您可以使用 location
作为 no
var ref = cordova.InAppBrowser.open(url, target, options);
您的代码将变成
this.rave.render(secure_link, this.iab,{location: 'no'})
编辑 -
尝试创建一个iab对象,然后将其传递给this.rave.render
let browser = this.theInAppBrowser.create(secure_link, _blank,{location: 'no'});
然后这样传下去
this.rave.render(secure_link, browser)