Disable User Interactions On The Webpage - disableEverything

Disable User Interactions On The Webpage - disableEverything
File Size: 273 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

disableEverything is a cross-browser and mobile-compatible jQuery plugin used to disable user interactions (scroll, copy, input, right click, etc) on the webpage.

A typical use of the plugin is to protect your website from image theft.

Features:

  • Disable right click.
  • Disable text/image copy.
  • Disable page scroll.
  • Disable keyboard input.
  • Disable image drag.

How to use it:

1. Insert the JavaScript jquery.disableeverything.js after jQuery JavaScript library.

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" 
        integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" 
        crossorigin="anonymous">
</script>
<script src="src/jquery.disableeverything.js"></script>

2. Call the function disableEverything on document ready and specify the user interactions to disable.

$(function() {
  $(document).disableEverything({

    // Disable Right Click
    disableRightClick: true,

    // Message when someone right clicks
    rightClickMessage: 'Right Click is Disabled.', 

    // Disable Text/Image Copy
    disableCopy: true,

    // Message when someone attempts to copy
    copyMessage: 'Copying is not Allowed.', 

    // Disable image drag
    disableImageDragging: true,

    // Disable Keyboard
    disableKeyboard: true,

    // Disable Page Scrolling
    disableScroll: true

  });
});

This awesome jQuery plugin is developed by HoaRoiCuaPhat. For more Advanced Usages, please check the demo page or visit the official website.