Disable 'Right-Click' and 'Dragging Images' on Your Website

By utilizing the Developer Tools in the SpaceCraft editor, you are able to disable the 'right-click' or 'context menu' for your images on the site. You can also disable the ability for users to click-and-drag your images from your website onto their computer's desktop or a folder. This is a helpful deterrent for piracy and image theft. 


Disable the Right-Click Function

To disable the ability for users to right-click on your site:

1. Copy the code below:

document.addEventListener('contextmenu', event => event.preventDefault());

2. Navigate to your SpaceCraft dashboard.

3. Navigate to your website's Developer Tools by clicking the [<>] icon on the grey navigation bar at the top of the page.

4. Click on Body JS; the link is located directly under the title Developer Tools.

5. You will see a text field. In the first available empty line (if you do not have any code here, it will be the first line in the text box), paste the code.

6. Click the blue Save button.

7. Click the green Publish button in the top-right corner of your site to publish the changes!



Disable the Drag-and-Drop Function

Follow the above steps 1-4 to navigate to the Body JS section of your Developer Tools dashboard. 

On a blank line in the Body JS text box, paste the below code:


Click the blue Save button, then click the green Publish button to confirm the changes on your website.

Powered by Zendesk