Stoping Right in a website

  danielsimmons 16:00 10 Nov 04

How do i stop people from right clicking in my website, because i need to stop people from viewing html for 1 page which contains usersnames and password to logon to the site.


  Sir Radfordin 16:08 10 Nov 04

Even if you do disable right clicking people will still be able to click edit/view source and have view it that way.

  danielsimmons 16:10 10 Nov 04

ok, but how do i disable the right click

  Sir Radfordin 16:42 10 Nov 04

this code should show an alert when right click clicked ....

<SCRIPT LANGUAGE="JavaScript1.1">
<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("Sorrrrry!!!For security resons, the right click feature has been disabled.");
return false;
return true;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
// End -->

  Taran 16:45 10 Nov 04

click here

click here

Or try a Google search, like this:

"JavaScript"+disable right click

If I read your original post correctly, I'm worried that you are using a totally insecure site restriction method.

Any web page that contains usernames and passwords in the source is a security nightmare. You can add as many disable right clicks as you like, you can easily use the edit/view source option in any browser to access the underlying code or, even better, those people who have disabled JavaScript in their browsers will not even be subject to the 'no right click' rule to begin with.

There are even 'sniffer' programs that people use to harvest email addresses and unprotected usernames and so on from websites, so an individual site visitor and her right click mouse action is the least of your worries.

User authenication can get quite complex. The easiest method I know of for people not familiar with web programming is to use CoffeeCup Password Wizard click here

Its results are quite secure, although not a patch on a good PHP, ASP, JSP or ColdFusion login application, and you can add one or many different username/password combinations, depending on your requirements.

Output is either Flash or JavaScript, you can choose which, and the file sizes are small. The trial version is a small download, it's drop dead easy to use and is as close as you'll come to anything like good security without implementing a dynamic language solution.

Usernames and passwords should never, ever feature in a web page, for pretty obvious reasons. Right mouse click prevention, just so that you know, is also a big problem for accessibility and sites that use it may encounter serious problems with disabled visitors.

Good luck with it.


  khedara 00:06 11 Nov 04

msn said hotmail will increase storage this Autumn from 2MB to 250MB, but till not

This thread is now locked and can not be replied to.

Microsoft Surface PC release date, price and specs: All-in-one Surface PC to directly rival iMac

1995-2015: How technology has changed the world in 20 years

Best Photoshop video tutorials: 8 video tutorial websites for Photoshop

Apple's event invitations decoded: A look back at 16 of Apple's most cryptic invites | Clues in…