Check if page was loaded after button to be clicked

Asked

Viewed 915 times

0

I have a button that calls other 4 buttons via jquery, each button opens a new tab and is in load state until the pdf is automatically downloaded, I need to check if this page has finished pressing to call the other buttons. Any suggestions?

function gerarTodosRelatorios(){    

 jQuery('.button1').on('click', function (e) {
     e.preventDefault();

     var target = jQuery(".button2");
     var target2 = jQuery(".button3");
     var target3 = jQuery(".button4");
     var target4 = jQuery(".button5");


     target[0].click();
     target2[0].click();
     target3[0].click();
     target4[0].click();
 });}

1 answer

1

I don’t know exactly how you’re opening the tabs, but I think you need to keep the tab reference open and call the other tab in her onload.

For example:

var aba= window.open('http://stackoverflow.com/', '_blank');
if (aba) {
    //navegador permitiu a abertura
    aba.onload(function(){
    //chamar aba 2

    });
} else {
    //Navegador bloqueou !
    alert('Bloqueado pelo bloqueador de popup');
}

this considering that the tab you say is a browser tab, if it is an HTML tab as a bootstrap of life, just use the onload in it

  • the tab is open after clicking on a link, this link opens a java function that generates a report. <a href="openNotificacaoPostagem.action? acao=print" class="spwBotao button3" target="_Blank">Lot CRM</a>

  • You will only be able to "see" a browser tab that you have the reference at the time of creation, so I think you have to change where the tab opens.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.