简体   繁体   English

如何强制重定向到手机浏览器的新窗口或标签页?

[英]How to force the redirection to a new window or tab in a mobile phone browser?

I am developing a "Vue" application which is basically an order form.我正在开发一个“Vue”应用程序,它基本上是一个订单。 In the final step, if you choose to pay directly you are redirected to a secure payment page, opening a new tab in the browser.在最后一步,如果您选择直接支付,您将被重定向到安全支付页面,并在浏览器中打开一个新选项卡。


      const url = "/api/es/orders/" + this.functionalId
      globalAxios
        .put(url, payload, config)
        .then(res => {
          if (res.data.dev_code) {
            if (this.selectedResume === "payment") {
              const urlPayment = Config.PAYMENT_URL + res.data.dev_code
              window.open(urlPayment, "_blank")
            }
          }
        })
        .catch(error => console.log(error))


The problem is that it does this on all devices except mobile phones.问题是它在除手机之外的所有设备上都这样做。 Is there any reason not to do it on mobile?有什么理由不在手机上做吗? Should I include something specific?我应该包括一些具体的东西吗? What am I doing wrong?我究竟做错了什么?

thank you all for your time and help感谢大家的时间和帮助

You should use Vue Router for this.为此,您应该使用Vue Router Look at the programmatic navigation segment in the documentation.查看文档中的程序化导航部分。

use location.href = URL That's what I do.使用location.href = URL这就是我所做的。 Theres also <a href=url>Here</a> but then they'd need to tap/click it...还有<a href=url>Here</a>但是他们需要点击/点击它...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM