How to disable Print Option in Website

Web Page printing is very easy method to steal information of copyrighted materials.if you are web developer and developed a web application but you don’t want to print webpage by any visitor then how will you do this??How to disable Print Option in Website?

I have solution for this problem.you don’t need write any big script code like php script or any serer side programming codes.

this can be done by simple css code.

CSS code means Cascading Style sheet.

Jut add a print media query in css file.

see example

@media print {
body {
display: none; /* this code will hide whole pages */
}
}

if you will add this CSS code in head section of HTML tag then visitor can not print webpage.

When visitor will try to print then whole webpage will show blank.

Now you can show print loading error message someone will try to print webpage , for show error write this code

@media print {
html,body {
display: none; /* This code will hide whole pages */
}
}

when you add html,body tag then print option will not work and this will show like this :

How to disable Print Option in Website

इसको शेयर जरुर करे और दुसरो को मदद करे
Ajay Kumar

He is a web developer, social media influencer and core programmer who love to write code, apart from this he loves to write tech article and share via social media. Right Now I Am A YouTuber And Investor In Share Market And Mutual Funds