|
Posted by BootNic on 10/30/06 17:57
> techfiddle <renaissance@australiamail.com> wrote:
> news: 1162216230.834474.151480@f16g2000cwb.googlegroups.com
> Disabling the right click and hiding the source code view may be two
> entirely separate issues. I Googled disable right click and
> encountered three separate blocks of source code, none of which;
> worked on my page at
> http://www.geocities.com/techfiddle//policies.html
>
> I also searched in this group "disable right click" but the entires I
> got were very old, probably not effective any longer.
>
> I remember from the past there was very short snippet of code that
> worked, but now I can't find it. I don't care so much about hiding
> the source code (though that would be cool), as much as protecting my
> images.
>
> During the Googling (Ask, actually), there was a software program I
> could buy for $40 which accomplishes this:
>
> http://www.antssoft.com/htmlprotector/index.htm
>
> So do I need to buy something or is there html that will accomplish
> this?
>
[snip]
Disable image right-click by capturing oncontextmenu.
Bypass by
- disabling JavaScript temporarily
- using a browser that doesn't support oncontextmenu
Javascript is usually used to add functionality to a site, when
javascript is used to disable functionality, it becomes an annoyance.
<script type="text/javascript">
function annoyance1(e)
{
var elm=e.target||e.srcElement;
if(elm.tagName.toLowerCase()=='img')
{
if(e.target)
{
e.preventDefault();
e.stopPropagation();
}
else if(e.srcElement)
{
e.returnValue=false;
}
alert('WARNING:\n¯¯¯¯¯¯¯¯ \nWe have determined that right clicking '+
'on images\nmay lead to unnecessary ware on your mouse.\n\nWe wou'+
'ld like to encourage you to save your mouse.\n\nBy avoiding right clic'+
'king images in the future, you may\nprevent the extinction of your m'+
'ouse.\n\nThis message was brought to you by your friendly\nneighbor'+
'hood webmaster.');
}
}
if(window.attachEvent)
{
document.attachEvent('oncontextmenu',annoyance1);
}
else if(window.addEventListener)
{
document.addEventListener('contextmenu',annoyance1,null);
}
</script>
--
BootNic Monday, October 30, 2006 12:56 PM
A well-developed sense of humor is the pole that adds balance to your
step as you walk the tightrope of life
*William Arthur Ward*
[Back to original message]
|