Disable copying data from webpage

I was looking for any way to create web page,so that user wont be able to copy content from my web page. i.e. User wont be able to select the any text present on the webpage.
Let’s assume i am working on asp.net

Any interesting ideas to accomplish the task ?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Ultimately you can’t.

If you disable the ability to select text, the context menu or even just the copy option from the context menu users will still be able to see your content.

If they can see it they can copy it:

  • Take a screenshot.
  • Take a photo.
  • Type the text they see into Notepad.
  • Dictate the text into a recorder.

It’s not worth the development effort and you won’t stop the determined copier. All you’ll end up doing is annoying your legitimate users.

Add value to your site so people want to keep coming back rather than just taking content and running. This could be:

  • Allow user generated content to expand on what’s there.
  • Update content regularly so it’s always fresh.

Method 2

You can use user-select CSS3 propertie

HTML like this :

<span class="protected">Datas you wants protect</span>

And the correspondant CSS :
.protected {

See my example : http://jsfiddle.net/DoubleYo/RPv4q/

This solution is not cross browser but work fine with firefox and chrome/safari

EDIT : advanced user can copy your content with view the page source, make pdf or print your page, and some people mention firebug, fiddler.

Method 3

If you send down any text the user will be able to see the source, so disabling copy and paste by any method will not really help stop the determined copier.

The most effective approach would be to render your text in to an image on the server and send down the image and not the raw text, but before you do that there are several downsides to consider: 1) You will require capacity on your server to generate the image. 2) The data load will be higher than just text and compresion will be less effective. 3) You may also loose some caching options.

Is there a particular reason you don’t want the user to copy the text, perhaps if you can provide more details other approaches may be possible?

Method 4

Try this

<script language="<strong class="highlight">javascript</strong>">

 function onKeyDown() {

// current pressed key
 var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();

 if (event.ctrlKey && (pressedKey == "c" || 
                    pressedKey == "v")) {
// <strong class="highlight">disable</strong> key press porcessing
event.returnValue = false;

} // onKeyDown


   <form name="aForm">
    <input type="text" name="aText" onkeydown = "onKeyDown()">

Method 5

When someone visits your website they receive the html/css/images/JavaScript that makes up the bulk of your site. So they already have your Content, as most browsers cache this too, to allow quicker browsing.

Read more on HTTP here – http://www.http.header.free.fr/http.html

So it is not quite possible to totally stop anyone that know how the http protocol works. But what you can do is to maybe listen for right clicks and stop normal end users from right clicking and saving a image etc. You can get a snippet here – http://www.dynamicdrive.com/dynamicindex9/noright.htm

But if you are talking about protecting images/files that are selling please have a look at Protect html/php/image files from tracking as it then applies to your problem.

Method 6

You can add to your body tag like so:

<body onselectstart="return false">

Method 7

This is Internet. You can’t completely protect the content of the page.

But you can difficult this task for the user.

You can too handle keyboard and mouse inputs, like Ctrl+C or right click of the mouse.

But remember that the user can always see the source code of the page, copy it and paste on a HTML editor.

You can make your site in Silverlight or Flash, but this will “disable” search engines indexing.

Method 8

convert your page into a image

Method 9

You can disable the selection, and with out selection you do not have copy/paste, however I suggest do that only on some parts of your page because is frustrate for the user.

This is the simple code that you can do that, eg, if you have a div with id="notme", run the disableSelOnThis("notme");

    function disableSelOnThis(IdName) {
        var oElem = document.getElementById(IdName);
        if (oElem)
            disableSelection(oElem); }

    function disableSelection(element) {
        element.onselectstart = function() {
            return false;

        element.unselectable = "on";
        element.style.MozUserSelect = "none";
        element.style.cursor = "default";   

The code was from : http://ajaxcookbook.org/disable-text-selection/ , but its seams that this site is not longer live.

Of course without javascript enable this is not working and everything ChrisF says still stands.

Method 10

Just copy and Paste the below javascript in your webpage:

<script language="javascript" type="text/javascript"> 
      function disableselect(e) {             
          return false 
      function reEnable() { 
          return true 

      document.onselectstart = new Function("return false") 

      if (window.sidebar) { 
          document.onmousedown = disableselect                    // for mozilla           
          document.onclick = reEnable 

      function clickIE() { 
          if (document.all) { 
              return false; 

      document.oncontextmenu = new Function("return false") 

     var element = document.getElementById('tbl'); 

     element.onmousedown = function () { return false; }        // mozilla         


Note:If the above code not works for Firefox then add style=”-moz-user-select:none” in the body tag which needs to be restricted alongwith the above code.

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x