How to Protect Images and Content on Your Shopify Website

Saif - Saif

Why This Matters

Protecting your Shopify site’s images and content is easy—just copy and paste a snippet—no apps required. Duplicate content clouds SEO: search engines struggle to pick the right version, splitting link authority and weakening your ranking. This hurts visibility, traffic, conversions, and brand credibility—so safeguard your assets now.

⚠️ Heads-up Before You Start

Editing your Shopify theme code requires a basic understanding of HTML, CSS, and JavaScript. Always duplicate your theme to create a backup before making any changes.

Step 1: Open Your Theme Code Editor

From your Shopify admin:

  • Go to Online Store → Themes
  • Click … → Edit code
  • Open the layout → theme.liquid file

Step 2: Add Anti-Theft JavaScript

Paste the following JavaScript right above the closing </body> tag in theme.liquid:

Copy

<script>
  document.addEventListener('contextmenu', e => {
    e.preventDefault();
  });
  
  document.addEventListener('keydown', e => {
    const key = e.key.toLowerCase();
    if (
      key === 'f12' ||
      (e.ctrlKey && e.shiftKey && ['i', 'j'].includes(key)) ||
      (e.ctrlKey && key === 'u')
    ) {
      e.preventDefault();
    }
  });

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

This Script Disables:

  • Right-Click
  • F12 (Inspect)
  • Ctrl+Shift+I (Inspect Shortcut)
  • Ctrl+Shift+J (Console)
  • Ctrl+U (View Source)
  • Text Copy

Step 3: Prevent Image Dragging

You can also block drag-and-drop image saving by disabling pointer interactions on images. On your theme’s main CSS file (usually base.css or theme.css in the assets folder), and add the following code at the bottom:

Copy

img {
  -webkit-user-drag: none;
  pointer-events: none;
}

This makes your images non-interactive — a simple but effective deterrent.

Final Thoughts

In 2025, content theft is easier than ever — and AI content scrapers don’t care about your Shopify Terms. Competitors can steal your photos, copy your product descriptions, and paste them into their own storefronts or fake marketplaces.

Back to blog