window.matchMedia('print') failing in Firefox and IE

后端 未结 2 1768
忘掉有多难
忘掉有多难 2021-01-21 06:10

I have a print button that launches the print functionality on any webpage. The button hides as soon as the user clicks on it and shows if the user is done printing or presses c

2条回答
  •  盖世英雄少女心
    2021-01-21 06:24

    You might want to look at the onafterprint event. At least this is triggered by Firefox and IE, so with a potential guard (to make sure the event did not fire multiple times) for your use case you can listen to both the matchMedia("print") and the onafterprint event.

提交回复
热议问题