Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

618
Views
Open multiple tabs at once with JavaScript

I am trying to open a few tabs at once from my shopping cart page using Javascript. I have looked at a few similar questions and I already know that you can use several window.open(url) but I'm not really looking forward to that... I currently have this code

function buyAll()
        {
            $.ajax({
                url:'Basket',
                type:'POST',
                data: { listOfWines : $.toJSON(chosenIds), action : 'buyAll' },
                success : function(responseText)
                {
                    for (var i = 0; i < allSliders.length; i++) 
                    {
                        var cellsCollection = document.getElementById(allSliders[i].id).closest('tr').children;
                        var row = document.getElementById(allSliders[i].id).closest('tr');
                        $(cellsCollection)
                        .animate({ padding: 0 }, 800)
                        .wrapInner('<div />')
                        .children()
                        .slideUp(function() { $(row).remove(); });
                    }
                    showSnackOpened();
                }
              });   

            for(i = 0; i < allSliders.length; i++)
            {
                var url = allSliders[i].getAttribute('data-redir');
                    window.open(url, '_blank');
            }
        }

Forgive me if the code isn't the best or there's a bit of a mix with the jQuery (JS isn't my best-known language) I take an array of elements on the shopping cart and get a particular attribute of these elements, which is the URL I need to redirect the user to. Once I have the list of URLs I try to iterate over them and open the new tabs. However, the browser obviously blocks the pages from the second onward.

Also, Chrome's tabs API won't be of any use to this project, since not all of the users will be using Chrome.

Any help is much appreciated!

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!