Prevent Content Theft By Disabling Text Selection

File Size: 6.08 KB
Views Total: 366
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Prevent Content Theft By Disabling Text Selection

This is a cross-browser jQuery content copy protection solution that prevents content theft from your website by using HTML unSelectable attribute, CSS user-select property, and JavaScript selectstart event.

See Also:

How to use it:

1. The main function that disables content selection. Copy and paste the following JS snippets after jQuery.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
  $.fn.disableSelection = function() {
    return this
    .attr('unselectable', 'on')
    .css('user-select', 'none')
    .on('selectstart', false);

2. Disable text selection on the entire page.


3. Or on a specific container.


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