Home   News  Product reviews  Website reviews  Forums   Competitions  Subscribe 


Web Building >> Web design & build

 |  Print Thread
mjsayles
Unregistered




Re: Disable right click
      Sun Jul 27 2003 08:50 AM

The following javascript in your source code will bring up an alert box when the user right-clicks:

Alt = "PUT YOUR ALERT WARNING IN HERE";
IsNS = navigator.appName=="Netscape"
IsIE = navigator.appName=="Microsoft Internet Explorer"
Ver = parseInt(navigator.appVersion)
function DoIt(a) { if (IsNS&&a.which>1) { alert(Alt); return false }
else if (IsIE&&(event.button >1)) { alert(Alt); return false; } }
document.onmousedown = DoIt;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (IsNS&&Ver<5) window.onmousedown = DoIt;

This code (unlike may others) will also work when the visitor holds down the left mouse button when right-clicking.

The following meta tag will get rid of the image toolbar (put it in the head of your document):

<meta http-equiv="imagetoolbar" content="no">

You can see them in action at http://www.lakelandscape.co.uk

Hope this helps.

Michael Sayles


Post Extras Print Post   Remind Me!     Notify Moderator
Rate this thread

Jump to


Entire topic
Subject Posted by Posted on
* Disable right click Anonymous Mon Jun 16 2003 08:28 PM
. * * Re: Disable right click Jonny555   Sun Jul 27 2003 11:39 AM
. * * Re: Disable right click DavidC   Thu Jun 19 2003 11:14 PM
. * * Re: Disable right click mjsayles   Sun Jul 27 2003 08:50 AM
. * * Re: Disable right click safeTsurfa   Mon Jul 28 2003 12:45 AM
. * * Re: Disable right click Anonymous   Mon Jul 28 2003 11:39 AM
. * * Re: Disable right click Anonymous   Mon Jul 28 2003 11:43 AM
. * * Re: Disable right click safeTsurfa   Mon Jul 28 2003 08:45 PM
. * * Re: Disable right click Anonymous   Fri Aug 01 2003 11:30 PM
. * * Re: Disable right click Sam   Sat Aug 02 2003 08:44 PM
. * * Re: Disable right click itsjustme   Sat Dec 24 2005 08:58 PM
. * * Re: Disable right click TheFatControlleRAdministrator   Sun Dec 25 2005 11:20 AM
. * * Re: Disable right click greystsModerator   Sun Dec 25 2005 11:27 AM
. * * Re: Disable right click TheFatControlleRAdministrator   Sun Dec 25 2005 11:56 AM
. * * Re: Disable right click greystsModerator   Mon Dec 26 2005 10:55 AM
. * * Re: Disable right click Jonny555   Mon Dec 26 2005 11:29 AM
. * * Re: Disable right click greystsModerator   Sun Dec 25 2005 10:09 AM
. * * Re: Disable right click Jonny555   Mon Jul 28 2003 08:19 PM

Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:  putasolutions, Joe_London, greysts, bricat, Nanook, Hello_There, John_McKenna, Mouse, TheFatControlleR 


Print Thread
Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      Mark-up is enabled

Rating:
Thread views: 65

Contact Us | Privacy statement Main website