FREE BLOGGER TRICKS

Sign Up To The Free Email Newsletter!

Want to get notified whenever we produce the latest content ? Then subscribe now to start receiving hot updates from today.

Thursday, 3 September 2015

How to disable right click on Blogger image

On : 9/03/2015


1. Log in to blogger and Go to Design >> Page Element

2. Click  'Add a Gadget' and select 'HTML/Javascript'

3.Paste below code.

<script language="JavaScript1.2">

var clickmessage="Right click disabled on images!"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}

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

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()
</script>

4. Now click save you are done.

0 comments:

Post a Comment