Happening now | Office Hours: Customizing Your Theme With Moeed | Ask your questions now!

How do i prevent imagens \ text from being copied ?

Solved

How do i prevent imagens \ text from being copied ?

Nykuu
Excursionist
15 0 5

Hi all !

 

Does anyone knows how to prevent content from being copied ?

It is possible to disable either selection, right clicking or screenshooting ?

Accepted Solution (1)

pawankumar
Shopify Partner
751 111 128

This is an accepted solution.

Hi @Nykuu 
Please try this code in theme.liquid before closing head tag </head>

<script>
  // Disable right-click
  document.addEventListener('contextmenu', function(e) {
    e.preventDefault();
  });

  // Disable text selection and copy
  document.addEventListener('selectstart', function(e) {
    e.preventDefault();
  });

  document.addEventListener('copy', function(e) {
    e.preventDefault();
  });
</script>

<style>
  /* Disable text selection for most elements */
  body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
</style>

Thanks!

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan

View solution in original post

Replies 3 (3)

BiDeal-Discount
Shopify Partner
779 101 173

I think no way if they know about technical. They can inspect browser and copy as they want

- Helpful? Like & Accept solution! Coffee tips fuel my dedication.
- BiDeal Bundle Volume Discounts: Upsell with discount bundles, quantity breaks, volume discounts & mix-and-match bundles. AOV+ with free gifts, free shipping & progressive cart
- Contact me via WhatsApp

pawankumar
Shopify Partner
751 111 128

This is an accepted solution.

Hi @Nykuu 
Please try this code in theme.liquid before closing head tag </head>

<script>
  // Disable right-click
  document.addEventListener('contextmenu', function(e) {
    e.preventDefault();
  });

  // Disable text selection and copy
  document.addEventListener('selectstart', function(e) {
    e.preventDefault();
  });

  document.addEventListener('copy', function(e) {
    e.preventDefault();
  });
</script>

<style>
  /* Disable text selection for most elements */
  body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
</style>

Thanks!

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan

StevenT_A7
Explorer
147 13 16

Hi Nykuu, 

 

This is Impossible on Website to prevent copying or screenshot of content or images.

 

Thanks 

Steven Taylor
302-260-8345