Disable right click on web page using jquery

Most webmasters want to protect their blog content from plagiarism. To protect blog content from copying we can do following to things.

  1. Disable right click on web page
  2. Disable content selection

as this is not 100% full proof way to protect your content from copying, Because  these methods require JavaScript and user can disable JavaScript to copy the content.To  disable right click on web page follow these steps

Include jQuery in your web page

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

Insert following code in head section

<script type="text/javascript">
    $(function () {
      $(document).on('contextmenu', function (e) {
        alert('Right Click is not allowed');

Published by Sunny

A Mechanical engineer by education and web developer by passion and profession. He lives in Lucknow, India. Currently earning his livings by hitting keyboad. ;)

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *