Skip to content
REFIERE JONYTIPS Y GANA COMISIONES! 💸 OBTÉN TU LINK DE REFERIDO 🔗 HAZ CLICK AQUÍ 🖱️ REFIERE JONYTIPS Y GANA COMISIONES! 💸 OBTÉN TU LINK DE REFERIDO 🔗 HAZ CLICK AQUÍ 🖱️ REFIERE JONYTIPS Y GANA COMISIONES! 💸 OBTÉN TU LINK DE REFERIDO 🔗 HAZ CLICK AQUÍ 🖱️

Cart

Your cart is empty

Article: Block the right click on your website for images and show a message

Bloquear el botón derecho en tu web para las imágenes y mostrar un mensaje

Block the right click on your website for images and show a message

Let's copy all this code and paste it into the theme.liquid of our template. To paste the code it has to be at the end of our template but before the <body> command ends

It has been proven that disabling the right mouse button on web pages only brings negative causes. This particular code acts only on the images and is to give a message (in addition to not allowing the image to be copied or saved in the first instance) unfortunately it will always be possible to save the element with the element inspector or other commands, but it is We can make it a little more difficult.

Paste this code between the two <head> of your theme.liquid

{{ «no-mouse-imagenes.js» | asset_url | script_tag }}

Then in the assets folder of the code editor create a new file and call it no-mouse-images and choose .js and paste this text that you added below.

If it is very difficult for you, you can find this Jony Tips in Products > accessories

 function disableClick(e) {
 var message = 'WOULD YOU STEAL A CAR?';
 if (document.all) {
 if (((event.button == 2) || (event.button == 3)) && ((event.srcElement.tagName == "IMG") || (event.srcElement.getAttribute("type").toUpperCase() == "IMAGE"))) {
 if (event.srcElement.oncontextmenu) {
 event.srcElement.oncontextmenu = function(event) {
 if (event.preventDefault) {
 event.preventDefault();
 };
 if (event.stopPropagation) {
 event.stopPropagation();
 };
 if (event.returnValue) { 
event.returnValue = false;
 };
 };
 } else {

 if (event.srcElement.addEventListener) {
 event.srcElement.addEventListener("contextmenu", function(event) {
 if (event.preventDefault) {
 event.preventDefault();
 };
 if (event.stopPropagation) {
 event.stopPropagation();
 };
 if (event.returnValue) {
 event.returnValue = false;
 };
 }

 );
 } else if (event.srcElement.attachEvent) {
 event.srcElement.attachEvent("contextmenu", function(event) {
 if (event.preventDefault) {
 event.preventDefault();
 }; 
if (event.stopPropagation) {
 event.stopPropagation();
 };
 if (event.returnValue) {
 event.returnValue = false;
 };
 }

 );
 };

 };

 alert(message);
 return false;
 };
 } else if (document.layers)

 {
 if ((e.which == 2) || (e.which == 3)) {

 if (e.target.oncontextmenu) {
 e.target.oncontextmenu = function(e) {
 if (e.preventDefault) {
 e.preventDefault();
 };
 if (e.stopPropagation) {
 e.stopPropagation();
 };
 if (e.returnValue) {
 e.returnValue = false;
 };
 };
 } else {

 if (e.target.addEventListener) { 
e.target.addEventListener("contextmenu", function(e) {
 if (e.preventDefault) {
 e.preventDefault();
 };
 if (e.stopPropagation) {
 e.stopPropagation();
 };
 if (e.returnValue) {
 e.returnValue = false;
 };
 }

 );
 };


 };


 alert(message);
 return false;
 };
 } else if (document.getElementById)

 {
 if (((e.which == 2) || (e.which == 3)) && ((e.target.tagName == "IMG") || (e.target.getAttribute("type") && e.target.getAttribute("type").toUpperCase() == "IMAGE"))) {

 if (e.target.oncontextmenu) {
 e.target.oncontextmenu = function(e) {
 if (e.preventDefault) { 
e.preventDefault();
 };
 if (e.stopPropagation) {
 e.stopPropagation();
 };
 if (e.returnValue) {
 e.returnValue = false;
 };
 };
 } else {

 if (e.target.addEventListener) {
 e.target.addEventListener("contextmenu", function(e) {
 if (e.preventDefault) {
 e.preventDefault();
 };
 if (e.stopPropagation) {
 e.stopPropagation();
 };
 if (e.returnValue) {
 e.returnValue = false;
 };
 }

 );
 };


 };


 alert(message);
 return false;

 };
 };

 };

 function associateImages() { 
for (i = 0; i < document.images.length; i++) {
 document.images[i].onmousedown = disableClick;
 };

 };

 if (document.all) {
 if (document.onmouseup) {
 document.onmouseup = disableClick;
 } else {
 window.onmouseup = disableClick;
 };

 } else if (document.getElementById) {
 if (document.onmousedown) {
 document.onmousedown = disableClick;
 } else {
 window.onmousedown = disableClick;
 };

 } else if (document.layers) {
 associateImages();
 }; 

Leave a comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

All comments are moderated before being published.

Read more

Agregar el precio de venta en cuotas 💴  con o sin intereses

Add the sale price in installments 💴 with or without interest

It is always a good sales tactic to give the value from or the value of the product quota since we are giving a very low amount to hook the customer. In general, it occurs with high-value produc...

Read more
Acepta criptomonedas como medio de pago en tu Shopify

Accept cryptocurrencies as a means of payment in your Shopify

The first thing we must do to receive payments from cryptocurrencies such as Bitcoin and Etherium is to have a Wallet (virtual wallet). For this we are going to go to https://commerce.coinbase.com...

Read more