CopyBlock is a lightweight, powerful JavaScript tool designed to prevent unauthorized copying, saving, printing, and inspecting of your website content. This makes it ideal for bloggers, businesses, designers, photographers, and anyone protecting digital assets.
This guide explains how to install CopyBlock, how each protection works, and how to add it to your website or CMS.
What CopyBlock Protects Against
CopyBlock includes the following protections:
-
Disable Right-Click
Prevents saving images, inspecting elements, or copying text. -
Disable Text Selection
Blocks highlighting and prevents copying content. -
Disable Image Dragging
Stops users from dragging images off the page. -
Disable Copy, Cut & Paste
Blocks keyboard shortcuts and menu actions. -
Disable Print (Ctrl+P)
Prevents printing and “Save as PDF.” -
Disable Save Page (Ctrl+S)
Stops users from saving your webpage locally. -
Disable Developer Tools Shortcuts
Blocks F12, Ctrl+Shift+I/J/C, Ctrl+U (view source). -
Disable Select All (Ctrl+A)
Prevents quickly selecting your entire page.
All protections activate immediately when the script loads.
Requirements
To use CopyBlock, you must have:
-
JavaScript enabled on the user’s browser
-
Ability to add custom JavaScript to your site
(WordPress, Shopify, Wix, Squarespace, Weebly, HTML/PHP sites, etc.)
Installation Instructions
CopyBlock installs with a single line of code.
Step 1: Upload the Script
Upload copyblock.js to your server, for example:
Step 2: Add the Script Tag to Your Site
Place this inside your HTML <head> section or before </body>:
Once added, all protection features become active automatically—no configuration needed.
How CopyBlock Works
CopyBlock uses JavaScript event listeners to intercept actions before the browser can process them.
The script disables:
-
Right-click menus
-
Text selection
-
Drag events
-
Copy, cut, paste
-
Developer tools shortcuts (F12, Ctrl+Shift+I, etc.)
-
View Source (Ctrl+U)
-
Select All (Ctrl+A)
-
Printing (Ctrl+P)
These features help prevent unauthorized copying and inspection of your site’s content.
Platform-Specific Installation
WordPress
-
Go to Appearance → Theme File Editor → header.php
-
Add the script before
</head>
OR
Use a plugin like Insert Headers and Footers.
Shopify
-
Go to Online Store → Edit Code
-
Open
theme.liquid -
Insert the script above
</body>.
Wix, Squarespace, Weebly
Use your platform’s Custom Code Injection or Embed Code feature.
HTML or PHP Website
Add the script tag directly inside your page template.
Testing CopyBlock
After installation, check that protections work:
-
Right-click → Should not open
-
Highlight text → Should not highlight
-
Drag image → Should not drag
-
Press F12 → Should be blocked
-
Press Ctrl+U → Should be blocked
-
Press Ctrl+A/C/V → Should not work
-
Press Ctrl+P → Print dialog should not open
If these actions fail, CopyBlock is working correctly.
Limitations
While CopyBlock provides strong deterrence, no JavaScript-based protection is unbreakable. Advanced users can still bypass browser-level restrictions.
CopyBlock is best used as a content protection layer, not a replacement for:
-
Digital watermarking
-
DRM systems
-
Copyright registration
However, for most visitors, CopyBlock will effectively prevent copying and unauthorized saving of your content.
Example HTML Integration
Need Custom Features?
CopyBlock can be customized to include:
-
Optional on/off toggles
-
Admin-only exclusions
-
Watermarking features
-
Minified or obfuscated versions
-
Per-element protection (protect only certain areas)