Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: How to disable Ctrl keystrokes


Message #1 by "Pat Waddington" <paw@s...> on Tue, 17 Apr 2001 23:30:45 +0100
You don't mind that the user can always do this from the menu (regular or
context-menu)?

Perhaps there is another solution to your problem, so I think it would be
interesting to find out what the problem really is? Why don't you want
people bookmarking the page?

For example, you could add a little function like this to each page to
prevent people arriving in the middle of your site (assuming the page they
are attacking exists!).

function sendOutsideLinksHome()
{
 if(document.referrer.search(/www.MyDomain.com/i) < 0)
  document.location.href = "default.htm" ;
}

Cheers,
Anil


----- Original Message -----
From: "Pat Waddington" <paw@s...>
To: "javascript" <javascript@p...>
Sent: Wednesday, April 18, 2001 12:30 AM
Subject: [javascript] How to disable Ctrl keystrokes


> I would like to disable Ctrl-D keystrokes to prevent a page being 
> bookmarked (in IE). I am able to trap and ignore Ctrl-G, Ctrl-M and some 
> others, but the browser seems to catch Ctrl-D and certain other 
> combinations that are meaningful to it before they can be trapped. Does 
> anyone know a way round this? I'll disable the whole keyboard if 
> necessary. The solution must work in IE and Navigator.
>
> Also, is there a Navigator equivalent to Ctrl-D to bookmark a page?
>
> Thank you
> Pat

  Return to Index