如何隐藏浏览器位置网址

时间:2020-08-20 11:04:12

标签: angular ionic-framework inappbrowser

大家好,请尝试将支付网关集成到我的Ionic应用中,代码运行良好,但是唯一的问题是如何隐藏inAppBrowser位置URL

打开方式

THis is how it opens

我希望它像这样打开而没有网址栏 I want it to open like this without the URL bar

这是下面的代码。谢谢

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
          })
      })

1 个答案:

答案 0 :(得分:0)

对于Cordova,在App Browser中,您可以将location作为no传递选项对象

var ref = cordova.InAppBrowser.open(url, target, options);

您的代码将变为

this.rave.render(secure_link, this.iab,{location: 'no'})

Reference

编辑-

尝试创建一个Iab对象,然后将其传递给this.rave.render

let browser = this.theInAppBrowser.create(secure_link, _blank,{location: 'no'});

然后像这样传递它

this.rave.render(secure_link, browser)
相关问题