Every now and then, a plugin comes about that has a good idea. Recently, this has been the mailcheck jquery plugin by Kicksend. According to their claims, it has reduced typos in emails during user signups by over 50%.
The plugin works by comparing the domain typed vs a list of pre-configured popular TLDs for email, such as gmail.com, hotmail.com and so forth – and providing recommendations based upon string similarity. As a result, typing ‘email@example.com’ ought to offer a suggestion ‘Did you mean firstname.lastname@example.org?’
We decided to implement it at work and I sat down to convert it to mootools. Regretfully, none of the code of the original plugin remains, including the string distance algo ‘sift3’, which proved inaccurate and failing in IE7.
The mootools version now features a few improvements over the original, namely:
- choice of method for determining string distance between Levenstein (the default choice) and sift3
- more performant
- look-up cache – any strings compared that return a match are cached
- shared cache – any new instances created will benefit from old lookups, useful for use in single page applications
- automated testing via buster.js – all included with a kick start guide.
Visit the repo and give it a go, it’s a solid idea now. I have even included a jsfiddle demo and it comes with little mysql query that will grab the most popular email domains from your existing user database so you can set it up to suit your own target audience.
View a video of CI auto testing via buster.js on this plugin: