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

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!

Screen_Shot_2020-04-21_at_11.07.40_AM.png

 

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:

$("img").mousedown(function(e){
e.preventDefault()
});

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

    • Related Articles

    • Website SEO Best Practices

      Search Engine Optimization (SEO) is the process of optimizing your website content to help maximize its performance in search engines and reach more users. Search engines like Google have developed highly complex algorithms that determine whether ...
    • Verify & Submit Your Website Sitemap to Google and Bing

      When you submit your sitemap to Google and Bing you can gain access to their various webmaster tools. These tools allow you to track how your website is performing in search results, which keywords your website appears for, find which websites ...
    • Website Accessibility/Make Your Website ADA Compliant

      Our platform can easily integrate third-party widgets that allow users with disabilities to read and utilize the content on your website. UserWay provides an accessibility widget that you can add to your website. This plugin analyzes your website's ...
    • Sell Products on Your Website

      To start selling products, set yourself up with an eCommerce platform! There are two different ways to begin selling products on your website: 1. Create links on your pages or in your navigation to your eCommerce site. This link will be available for ...
    • Add Script/HTML to Every Page on Your Website

      Note: This article provides steps for code provided by third-party sources. Any troubleshooting with third-party applications should be handled by the application’s support team or your custom developer. You can add scripts into a block so that it ...