Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
afterprint event on two separate pages

i hope i could find any help here, i am working on a html/js, jquery projects and trying to catch the afterprint event and it's working fine, the problem is that i have two separates pages and the two have a printing need in them, so when i close the print preview in one page, it's triggers both event of the two pages. this is the function i used in the two pages :

(function () {
        var globalUrl = '@Url.Content("~/")';
        var afterPrint = function () {
            setTimeout(function () {
                $.confirm({
                    title: 'Confirmation',
                    content: "<div><span class='printing-message'>" + "L'impression doit être collée sur votre colis" + "</span></div>",
                    backgroundDismiss: false,
                    backgroundDismissAnimation: 'shake',
                    buttons: {
                        OK: {
                            action: function () {
                                this.close();
                                window.location = globalUrl + "Colis/MyDeliveryRequests";
                            }
                        }
                    }
                });
                }, 500);
            };

            if (window.matchMedia) {
                var mediaQueryList = window.matchMedia('print');

                mediaQueryList.addListener(function (mql) {
                    if (!mql.matches) {
                        afterPrint();
                    }
                });
            }

            window.onafterprint = afterPrint;
    }());
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda