How to protect image and content your shopify website

Protect Image and Content to your Shopify website is easy. Just copy and paste a bit of code and you’re all set! No need to use any app. The script will Disable Inspect Element. Edit the code for a theme if you know HTML and CSS, and have a basic understanding of Liquid.

I wrote a script that disables practically all the ways to access Inspect Element in JavaScript. Here’s what it blocks:

Right Click
F12
Ctrl + Shift + I
Ctrl + Shift + J
Ctrl + U

What do you need?

Basic JavaScript knowledge
HTML editor

What do you do?

From your Shopify admin, go to Online Store > Themes

Click Actions > Edit Code

The code editor shows a directory of theme files on the left, and a space to view and edit the files on the right:

How to protect image and content your shopify website

Copy the HTML below and paste on theme.liquid!

 <body oncontextmenu="return false;"> 


Copy the JavaScript below and paste on the bottom theme.liquid!

 document.onkeydown = function(e) {
if(event.keyCode == 123) {
return false;
}
if(e.ctrlKey && e.shiftKey && e.keyCode == 'I'.charCodeAt(0)){
return false;
}
if(e.ctrlKey && e.shiftKey && e.keyCode == 'J'.charCodeAt(0)){
return false;
}
if(e.ctrlKey && e.keyCode == 'U'.charCodeAt(0)){
return false;
}


And that’s it!

If you have any trouble, feel free to leave a comment below and I’ll do my best to help.

Need Shopify Expert Help?

If you need any Shopify expert help, you can try on Shopi Tasker . Shopi Tasker is a certified Shopify expert agency. They have been focused on delivering small & big tasks to Shopify users and have helped over 100+ Shopify store owners get stuff done.

Leave a comment

Please note, comments must be approved before they are published