Forum Moderators: open
<script>
function rightClick()
{
if (event.button == 2 ¦¦ event.button == 3 ¦¦ event.keyCode == 93)
{
alert("Some message");
return false;
}
return true;
}document.onmousedown=rightClick;
document.onmouseup=rightClick;
document.onkeydown=rightClick;
</script>
Ideally though I'd like to prevent access to the right menu but just have nothing happen instead of the alert - I can't seem to get it to work though. I only need this for IE5+, any ideas anybody?
I know these scripts are far from fool proof... but we like the idea of making things just that tiny bit more difficult;)
The no Right Click is a gimmick at best and an annoyance at worst.
Even web users witha little savvy can go to the View Menu to view source.
What I've seen (and I can't find it now that I'm looking for it!) is a view source that would have about 60 blank lines at the top of the source code, so it looks like the "source" is blank. Of course if someone were to scroll down they'd see the code.
I'm resigned to having my code looked at. That's what I like about server side ASP and such - that gets hidden.
Got any ideas on how I can get that right click without popup?
*I'm aware that people can use keyboard shortcuts etc...
It is possible to get round all of this with some complicated page and session management code but often the additional effort isn't justified.
Now for something hopefully more useful ;)
Works for IE, Netscape (<6). But won't work for Opera, Mozilla etc etc.
Let them see the HTML all they want - it still doesn't reveal the database structure or the SQL commands being used, or your nifty techniques.
OK - look - I've never used right click protection to stop people from viewing my source. Never, ever.
Though I do think if you have, say, some images that are precious to you and you want to put them on the internet but don't want them ripped off then a little 'reminder' does no harm. This way you don't have to disfigure the image with a watermark and someone taking it is fully aware that you'll be miffed when they do...
[msdn.microsoft.com...]
Though this isn't bullet proof either - just an extra level.