0

I recently noticed that many of competitors are copying text from my website, I tried to disable selecting / right click.. unfortunately they still managing to do it.

any creative idea will be great.

Ofek
  • 1
  • 1
    You can't prevent users from copying your content. They can see your code in view-source, `fetch`, server to server call, etc. – Mosh Feu Oct 28 '20 at 09:43
  • 1
    https://stackoverflow.com/questions/3161548/how-do-i-prevent-site-scraping – Adrian Oct 28 '20 at 09:43
  • Of course I can't completely prevent this to happen, but I can make it harder so they give up :) I seen websites that have some cool things, like when you copy the text it adds up their name or the text turn into gibberish... I ain't a website developer I don't really know how those things so I was looking for help:) – Ofek Oct 28 '20 at 10:04

3 Answers3

1

There's a very sleek CSS property: user-select. Set it to none.

user-select: none;

Don't forget to add the variants like webkit-user-select etc.

abdullahQureshee
  • 322
  • 2
  • 12
0

This can simply done by adding:
user-select: none;

Virej Dasani
  • 185
  • 3
  • 15
0

No that method will make somehow to copy it. So I wrote code that disables all the ways to copy the text in HTML.

And I'll give you the code and also you can check out on my github page.

        <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Webuzz - Ultimate Text Copy Disabler</title>
    
      <style>
        body {
          -webkit-touch-callout: none; /* Disable iOS copy/paste menu */
          -webkit-user-select: none; /* Disable text selection */
          -khtml-user-select: none;
          -moz-user-select: none;
          -ms-user-select: none;
          user-select: none;
        }
      </style>
    </head>
    
    <body oncontextmenu="return false;"> <!-- Disable right-click -->
      <h1>Webuzz - Ultimate Text Copy Disabler</h1>
    
      <p>This page has disabled text copying, right-clicking, keyboard shortcuts, and more.</p>
    
      <script>
        // Disable keyboard shortcuts
        document.addEventListener('keydown', function(e) {
          if (e.ctrlKey && e.shiftKey && e.code === 'KeyI') {
            e.preventDefault(); // Disable Ctrl+Shift+I
          }
          if (e.ctrlKey && e.code === 'KeyU') {
            e.preventDefault(); // Disable Ctrl+U
          }
          if (e.ctrlKey && e.code === 'KeyF') {
            e.preventDefault(); // Disable Ctrl+F
          }
          if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.code === 'KeyS') {
            e.preventDefault(); // Disable Win+Shift+S (Windows) or Command+Shift+S (Mac)
          }
        });
    
        // Detect extensions that enable copy and right-click
        document.addEventListener('contextmenu', function(e) {
          var selection = window.getSelection().toString();
          if (selection === '') {
            var extensionNames = ['enable', 'right', 'copy']; // Example extension names
            var detected = extensionNames.some(function(name) {
              return document.title.toLowerCase().includes(name.toLowerCase());
            });
            if (detected) {
              e.preventDefault(); // Disable right-click when extension is detected
            }
          }
        });
    
        // Disable print screen (PrtSc) key
        window.addEventListener('keyup', function(e) {
          if (e.code === 'PrintScreen') {
            e.preventDefault();
            alert('Print Screen is disabled on this page.');
          }
        });
      </script>
    </body>
    
    </html>

https://github.com/spidychoipro/Disable_copy_pro

Parking Master
  • 551
  • 1
  • 4
  • 20