Skip to content
WJunction - Webmaster Forum

Redirect Website Via A Key ?

Status
Not open for further replies.

msk19994

Distinguished Member
2,813
2011
567
Hey Guys
I am looking for a code which i can implement on my website that will redirect the user to another site if the user presses a particular letter or presses ctrl+z on my site he gets redirected to google.
Thanks
 

4 comments

Code:
<html> <head> <title></title> </head> <script language="JavaScript"> J4 = (document.layers) ? true : false;  function checkKey(event) { 	 	var code = 0; 	 	if (J4) 		code = event.which; 	else 		code = event.keyCode; 	if (code==keycharsetneededhere) 		document.location.href="http://www.yoururl" } </script>  <body onkeypress="checkKey(event)"> Redirect Now </body> </html>

http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes

^^^ use that page to get the key code for your keyboard key presses. When the key is pressed it will redirect to the page specified
 
Status
Not open for further replies.

About the author

M
Distinguished Member · Joined
2,813
Messages
567
Reactions
113
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom