jQuery plugin for disabling right mouse click, text selection and document save

Hi Guys,

Sometimes out content is really precious and we want to provide some basic protection against the content hackers. Now nothing in the web of world can be protected 100% because there are many ways to get your page content anyway. But this plugin gives basic protection against

  1. Text Copy
  2. Document save

It handles mouse and keyboard events perfectly to give you that sense of security. To get hold of your content, someone will have to do a little bit more than just select, copy and paste.

I will also through a demo at the end of this page but let me show you what this plugin is all about first.

You will have granular control on what a plugin should do or what it should do, like say for example you can tell the plugin to

  1. Block right mouse click
  2. Or Block Text selection on your page
  3. Or to Block Text selection by keyboard.
I named this plugin as jctextcopyprotector, sounds cool, right! 🙂 not that much I would assume.

Alright here is the plugin code

Fork it on GitHub


The Plugin Code

[geshi lang=”javascript” nums=”1″ target=”_self” ]

Alright lets discuss the settings properties


Stick this code somewhere on your page

[geshi lang=”javascript” nums=”1″ target=”_self” ]


  • blockRightClick:true|false,
    This option if set to true will block context menu to appear
  • blockDocTextSelection:true|false,
    This option if set to true will disable text selection using mouse
  • useCSS:true,
    This option if set to true will use CSS to block text selection on your document
  • blockPageSave:true,
    This option if set to true will block keyboard event such as Ctrl+A, Ctrl+S , Ctrl+C
  • alertUser:false,
    This option if set to true will show an alert message when a blocked event is detected.
  • alertMessage:”
    Custom alert message

Alert message on Right Click on one of my test pages looks like this


Alright so that’s the test stuff. you can try it yourself from the link below

The Demo


I hope that this little snippet will be helpful to you.

It definitely will be helpful to me in future 🙂







  1. ananta.seth7 says

    Hello sir,
    i can save your page by pressing Ctrl + S, is there any solid way to prevent html page saving ???
    STEP to SAVE:
    click on the address bar text, press Ctrl + S, done..

    • nah! there are by far many ways for people to get your content copied. One easy way is to disable javascript :). Javascript can never 100% protect your content ever. There are so many reasons for that.

      • David Machado says

        you can use javascript to decode a encrypted page, them block copy.
        well, you can disable javascript, but… with no javascript the encrypted page can´t be decrypted… 🙂

  2. Anil Kumar says

    It may have some dependencies but still it is a very nice plugin to restrict the COPY, SELECT ALL from the browsers.

    Thanks Jaspreet

  3. The example works for a normal user, but we can still copy text from firebug. I don’t think hacker won’t be that dumb.

  4. Doesn’t work on IE8 Win7

  5. Does not work on android tablet

  6. Doesn’t work on Mac xD

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.