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

178
Vistas
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 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