As we can see today, browsers such as Opera do not allow the right-mouse button to be disabled.many of the code examples used to disable the right-click no longer work in most...

"Read More" is very important. This trick will automatically create post summaries and guess what? With thumbnails too. Extra code in your blog post? No need anymore...

RSS Subscription

Subscribe via RSS reader:
Subscribe via Email Address:
 

How To Disable Right Click

Posted By AirielKayz On Sunday, February 28, 2010 Under , ,


As we can see today, browsers such as Opera do not allow the right-mouse button to be disabled.many of the code examples used to disable the right-click no longer work in most browsers. In addition to this issue disabling the right-click can cause serious accessibility issues and often only angers users.

But, we can still try, right? Let me show you 2 or 3 tricks about this thing.

First Way: Disable Right Click Or Drag Picture

Go to Blogger Dashboard >> Layout >> Edit HTML and find this tag: <body>.
Replace the tag with this code:-

<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false">

Second Way: Disable Right Click Or Drag Picture II

Go to Blogger Dashboard >> Layout >> Add A Gadget >> HTML/Javascript. Copy the code below and paste it into the HTML/Javascript box.

<script>
var isNS = (navigator.appName == "Netscape") ? 1 : 0;

if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);

function mischandler(){
return false;
}

function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;

</script>

Click "Save".

Third Way: Copyright Notice When Clicking On Image

Go to Blogger Dashboard >> Layout >> Add A Gadget >> HTML/Javascript. Then copy the code below and paste it into HTML/Javascript box.

<script language="JavaScript" type="text/javascript">
<!--
function popupMsg(theMsg) {
alert(theMsg);
}
//-->
</script>

Click "Save". Wait! It's not finish yet. When adding an image into your post, you will see the image tag similar to the below example:

<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQqWsXz-5vpKQX_jch_d5n_MnZcBCrYKRpfnM7wZ1cfngbakL9dQLLQ99Kv5iWuwQRU1Q3hucEf0qGzQ-bBrblee9gz22Ljess5rrxrmFqOVsb4cT_yCNGP1W9IHA50Q8BaDAgnfrV-O2/s1600-h/love.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQqWsXz-5vpKQX_jch_d5n_MnZcBCrYKRpfnM7wZ1cfngbakL9dQLLQ99Kv5iWuwQRU1Q3hucEf0qGzQ-bBrblee9gz22Ljess5rrxrmFqOVsb4cT_yCNGP1W9IHA50Q8BaDAgnfrV-O2/s320/love.jpg" /></a></div>

Add this:

onMouseDown="popupMsg('Copyrighted -- TycoBlogger 2010')"

after the highlighted image tag above and you image tag will be like below example:-

<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQqWsXz-5vpKQX_jch_d5n_MnZcBCrYKRpfnM7wZ1cfngbakL9dQLLQ99Kv5iWuwQRU1Q3hucEf0qGzQ-bBrblee9gz22Ljess5rrxrmFqOVsb4cT_yCNGP1W9IHA50Q8BaDAgnfrV-O2/s1600-h/love.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQqWsXz-5vpKQX_jch_d5n_MnZcBCrYKRpfnM7wZ1cfngbakL9dQLLQ99Kv5iWuwQRU1Q3hucEf0qGzQ-bBrblee9gz22Ljess5rrxrmFqOVsb4cT_yCNGP1W9IHA50Q8BaDAgnfrV-O2/s320/love.jpg" onMouseDown="popupMsg('Copyrighted -- TycoBlogger 2010')"/></a></div>

**NOTE** Just change the words (in blue color) with you own words or notice. Click the below image to see the effect:-


Click HERE to see more demos.
So, lets try!.



Btuts by TycoBlogger is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Malaysia License.
Based on a work at tycoblogger.blogspot.com.


 
Creative Commons License
javascript:void(0)