TransWikia.com

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

Stack Overflow Asked on January 10, 2021

I am developing a "Vue" application which is basically an order form.
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

2 Answers

You should use Vue Router for this. Look at the programmatic navigation segment in the documentation.

Correct answer by Agénor Debriat on January 10, 2021

use location.href = URL That's what I do. Theres also <a href=url>Here</a> but then they'd need to tap/click it...

Answered by TheComputerWizard on January 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP