C
C
Cyril2018-02-09 00:36:09
JavaScript
Cyril, 2018-02-09 00:36:09

Multiple windows on 1 click in Chrome, JS?

There is a code that, when clicked, searches in a block with links, 3 pieces by class and should launch 3 at once in a new tab (for ease of work in the site admin), but at the moment only the first one is launched. Doesn't work in chrome, does anyone know how to make it work? Thank you!

(works fine in firefox but not chrome)
https://jsfiddle.net/jrc5ue5v/5/

just code

jQuery(function($){
    $(document).ready(function(){
        $("a.bulk_action_link").click(function(event) {
            var href1 = $(this).closest('.links_wrap').find('.link1').attr('href');
            var href2 = $(this).closest('.links_wrap').find('.link2').attr('href');
            var href3 = $(this).closest('.links_wrap').find('.link3').attr('href');
            
            window.open(href1, 'bulk_' + Math.random());
            window.open(href2, 'bulk_' + Math.random());
            window.open(href3, 'bulk_' + Math.random());
        });
    });
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2018-02-09
@jensen6720185

If the test is in firefox, then there is some kind of trouble with the opening of new windows, my router on vuejs is also stupid. The problem may not be in this, but I think it's worth checking in other browsers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question