A quick and silly script for adding the konami code easter egg to your site. Works with gestures on iPhone as well.

View the Project on GitHub snaptortoise/konami-js

Simplified Implementation

Previously the simplest version of a Konami-JS implementation looked like this:

var easter_egg = new Konami();

This would redirect the user to a specified website upon successfully completing the Konami Code.

You could also pass along a function to execute when the easter egg is completed. The simplest version of that looked like this:

var easter_egg = new Konami();
easter_egg.code = function() { alert('Konami code!'); }

That is even sillier than the other implementation.

You can now set either the URL to redirect to OR the function to execute when you instantiate the class:

var easter_egg = new Konami('http://your-special-easter-egg-website.com');


var easter_egg = new Konami(function() { alert('Konami code!')});

A passed string is assumed to be the URL to redirect to. A passed function will be executed when the code is successfully entered:

This is why you do code reviews more often than once ever two years.


Every site should have an implementation of the Konami Code. It makes things more fun. If you're unfamiliar with it, the Konami Code is a "cheat code" that appeared in many of Konami's video games going all the way back to 1986. It was typically entered on a Nintendo controller. Recently, ESPN received attention for the funny, flashy things that would happen when the code was entered on their website. Those shenanigans were the inspiration for whipping up this script.

Gesture Support

As of version 1.1, Konami-JS includes support for gestures on iOS and Android devices. Technically the code becomes "up, up, down, down, left, right, left, right, tap, tap, tap," on these devices but that's close enough!

Support for touch gestures is automatically loaded when konami.load() is called.

As Seen On...