What steps can you take to trigger redirection to a new window or tab on a mobile phone browser?

I've been working on a "Vue" application that serves as an order form. In the final step, when you opt to make a direct payment, you get redirected to a secure payment page which opens in a new browser tab.


      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 issue I'm facing is that this redirection works on all devices except for mobile phones. Do you know why this might be happening? Is there anything specific I need to include or change for it to work on mobile? What could I possibly be doing wrong?

Thank you everyone for taking the time to read this and offer your help!

Answer №2

My preferred method is to set location.href = URL. Alternatively, you can also use <a href=url>Here</a>, but this requires the user to tap/click on it.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Resolving issues with jQuery input values

I have been working on a form that allows users to choose an amount or specify another amount. When the user clicks on "other amount," it changes the displayed amount to $5. My goal is to make it so that when the user specifies an amount other than 5, it u ...

Ways to attach a Javascript function to HTML content that is loaded dynamically

Utilizing the s3_direct_upload component, typically you would activate it by connecting your element to a function in either the ready or load event as shown below: $(function() { $('#s3-uploader').S3Uploader( { remove_completed_pr ...

Undesirable flickering animation on button

Is there a way to display a dynamic button that follows the mouse cursor when hovering over an image? If you want to see the code in action, check out this codepen link. const box = document.getElementById("box"); function movebox(e) { box.style.lef ...

Ways to substitute PHP functions using AJAX

I'm a beginner with AJAX. How do I replace the initial PHP function after an AJAX action is executed? It seems that the page does not refresh after the action takes place. Below is the code: Javascript function set_ddm(another_data) { var resul ...

Unable to transfer files, encountering issues with PHP and AngularJS integration

I am currently working on uploading files using both AngularJS and PHP. For the AngularJS part, I am utilizing angular-file-upload from https://github.com/danialfarid/angular-file-upload. I suspect that the issue lies in my PHP code, as it fails to move ...

The driver instance that has forked will never cease

Issues arise when attempting to run multiple browser windows in Protractor. The code snippet being tested is as follows: I create a new browser instance to perform certain tests. When input is entered into the original browser, it should not affect the ne ...

What could be the reason for the empty value of driver_execute?

I'm attempting to input text into a textfield using code. binary = FirefoxBinary("C:\Program Files\Mozilla Firefox\Firefox.exe") driver = webdriver.Firefox(firefox_binary=binary) text = 'sending something to the text area' ...

Checking the formik field with an array of objects through Yup for validation

Here is a snippet of the code I'm working on: https://codesandbox.io/s/busy-bose-4qhoh?file=/src/App.tsx I am currently in the process of creating a form that will accept an array of objects called Criterion, which are of a specific type: export inte ...

Tips on utilizing jQuery Autocomplete to redirect to a different page based on the selected id

I'm new to this and eager to learn. I've been struggling with a problem for hours now and I couldn't find the solution. Hopefully, someone here can assist me. What I'm attempting to do is retrieve and display data from my table (city n ...

Engaging in Communication with Two Unique User IPs

Is there any way to facilitate communication between two users on a site? For example, if user1 clicks on user2's name (along with their IP address) and sends a message. I know that using a database and AJAX can save messages and send them to user2, b ...

Jquery doesn't immediately hide an element after the first click.TabPage.getSelection().extentNode rectangular_HTML

I'm experiencing a peculiar issue with an event listener $(document).on('click', '.suggested-location-item', function(event) { event.preventDefault(); $('#IDsuggestedLocationsList').html(''); $(&apo ...

What is the best way to ensure that a task is performed only once the DOM has finished loading following an AJAX request

<div id="mydiv"> ... <a id="my-ajax-link"> ... </a> ... ... <select id="my-selectmenu"> ... </select> ... </div> Upon clicking the 'my-ajax-link' link, it triggers an AJ ...

jQuery loading and updating

I am faced with a scenario where I have both a 'test.html' and a 'test.php' files. The content of 'test.html' is as follows: <html> <head> <script type="text/javascript" src="/js/jquery-1.8.2.js">< ...

Retrieve data from a JSON array using either JavaScript or PHP

Check out my code snippet: const newData = [{"new_id":"1","new_no":"1","total":"N.A"},{"new_id":"2","new_no":"3","total":"4"},{"new_id":"2","new_no":"4","total":"5"}]; Now, I need to extract specific details from this JSON data based on the 'new_no& ...

Accessing Elements by Class Name

I've been searching for information on the capabilities of getElementsByClassName for hours. While some sources mention it returns an HTML collection of items, length, and named items, w3schools provides an example where innerHTML is utilized: var x ...

Mistakes while utilizing the yarn package manager

Lately, I've been relying on using sudo with npm to install packages, but I've come to realize that this is not a good practice. In light of this, I decided to switch to yarn for managing my packages. However, I'm encountering some errors af ...

Troubleshooting node.js nodemailer sending email via Gmail

I am attempting to send an email using the nodemailer module in node.js. My code is structured as follows: var http=require("http"); var nodemailer=require("nodemailer"); http.createServer(function(req,res){ res.writeHead(200, {"Content-Type": "text ...

Repeatedly iterates through the JSON properties that have been grouped together

https://jsfiddle.net/MauroBros/f1j0qepm/28/#&togetherjs=qedN5gf7SF Upon examining a JSON object, the structure is as follows: var values = [ {"aname":"account1", "pname":"pname1", "vname":"vname1& ...

What is the process for configuring a registry for a namespaced package using yarn?

Experimenting with yarn as a substitute for npm has been quite interesting. With npm, we usually rely on both a private sinopia registry and the official repository for some namespaced packages, since sinopia doesn't support namespaces. My .npmrc fi ...

Difficulty encountered in constructing a menu through the process of iteration

As a newcomer to Vue and Vuetify, I am trying to create a submenu using v-menu. The construction involves iteration, where each sub menu needs to be assigned a method. However, my current approach is resulting in an error message: [Vue warn]: Error in v ...