Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!