How to Use Konami Code On your Website

The well-appreciated and possibly most-remembered “secret” code of all time, The Konami Code, a cheat code that originated on the original NES and has since made its way into many other games.
up, up, down, down, left, right, left, right, B, A

But it is not only limited to games anymore! You can include this on your own website to make an awesome impression on the viewers.

You can see a working example (and subsequently many more) on http://www.konamicodesites.com . This site also lists many more websites which use this code. Go to the website and use the key code mentioned above to get in.

The code to include konami is very simple. Let us say I want to redirect the website to go4expert when the code is entered on any web page. All I have to do is include the following JavaScript code.


Code:
<script type="text/javascript">
if ( window.addEventListener ) {  
  var state = 0, konami = [38,38,40,40,37,39,37,39,66,65];  
  window.addEventListener("keydown", function(e) {  
    if ( e.keyCode == konami[state] ) state++;  
    else state = 0;  
    if ( state == 10 )  
      window.location = "http://www.go4expert.com";  //you can write your own code here
    }, true);  
}  
</script>
Hopefully, the code is very simple to understand. Place this in your HTML file and you are good to go!

Share this

Related Posts

Previous
Next Post »