Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

619
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda