How to stop user from printing webpages? using javascript or jquery

后端 未结 9 673
谎友^
谎友^ 2020-12-03 12:34

How can we stop users to print webpage using different methods?

  1. Disabling Right Click
  2. Disabling CtrlP combination of keys
  3. <
9条回答
  •  無奈伤痛
    2020-12-03 13:20

    I tried this way of Chris

    @media only print {
    .container { display:none !important; }
    }
    

    it's work. But when I press F12 to open developer tool, find the line ".container { display:none !important; }" delete it, and then ctrl + p, every thing are show again on print windows. May be have no solution with 100% for prevent print webpage content.

提交回复
热议问题