How to disable save and print of web page from browser

I see this question and related questions posted in a lot of web programming forums. And I always end up answering it the same way. And I still don't know why people try to fight the battle that can't be won. I remember some time back I was asked to look at a site that will not allow user to right click on image save it locally. The user asked me that she want to save it locally to manipulate it. You really did not need any tools to accomplish that. Answer was very simple, goto Temporary Internet Files folder and there you will find these images.

Now you see why it is just not possible to prevent save or copying of any content that is published on internet. If you are still not convinced, then I will tell you what I will do to copy content from your site. May be that will give some food for your thoughts.

  1. I will look in the temporary internet files folder first and grab the content from there.
  2. If I can't find content in temporary folders, I will write two lines of code to send a HTTP GET request to your page using HttpWebRequest (in .Net) or other means in other languages to get response stream from the page, convert it to text and save it. You are sending HTML response back from your page so how hard it is to save it as HTML file and then view it.
  3. And if want to parse data out of your pages, then I will use tool like HTMLParser.Net to get all the content from your page and do whatever i want to do with it.

There are some steps you can take to make it difficult for regular user to copy the content

  • Disable right clicking on the page by trapping right mouse click event using javascript.
  • From landing page of your application, open the main page of the application in a new browser window and remove all menu bars, tool bars etc. Well, it is going to be very annoying for the user.
  • From server side, set caching headers appropriately to let browser know that content is not be cached. That will make the browser to get fresh content from the site all the time. That means slow user experience.
  • User document.write to write the whole HTML in memory. This will make it difficult for the BOTs to parse the pages. But then you will also loose visibility in search engines as well.

But as I said you can't hide content of your pages from the user. I have given you all the options and down side of doing it as well. So pick your battle wisely.




15.9 °C / 60.6 °F

weather conditions Clouds

Monthly Posts

Blog Tags