HTML5 Zone is brought to you in partnership with:

I'm a writer, programmer, web developer, and entrepreneur. Preona is my current startup that began its life as the team developing Twitulater. Our goal is to create a set of applications for the emerging Synaptic Web, which would rank real-time information streams in near real time, all along reading its user behaviour and understanding how to intelligently react to it. Swizec is a DZone MVB and is not an employee of DZone and has posted 67 posts at DZone. You can read more from them at their website. View Full User Profile

Alertify.js: Pretty Cool

  • submit to reddit

Sometimes you come across a library so full of promise and amazingness that you have to write about it before even trying it out.

Alertify.js is a javascript library that brings alert() and prompt() into the web world of 2012. No longer will you be forced to use some arcane instruction full of ugly windows and so terribly un-new it sends chills down your spine just thinking about using it.

Really … was anyone still using that for anything other than debugging? Besides porn phishing sites I mean.

The old alert()

The old alert()

The difference between old way and new is realy quite amazing. While a normal alert() creates a whole new window and blocks javascript execution, alertify’s alert box is a lot easier on the eye, rolls nicely down from the top of the window and most of all is customisable.

Although blocking execution would actually be kind of useful, alertify.js can fake this with careful use of callback soup and apparently manages to do something to at least prevent clicking on the page. So unless you get an event from a timer or a socket, you can rest assured nothing will happen while the alert is displayed.

It also plays nice with us keyboard maniacs – you can use the ESC key to make a Prompt or Confirm dialog go away.

Another feature I really like are the logging facilities. It’s a log you actually won’t mind showing to your users! Wonderful.

Log messages

Log messages

Then again, for debugging I will probably still be using console.log and ruining my sites for all Internet Explorer users when I forget to remove debugging lines … with alertify.js it’s at least impossible to forget.

Oh and another cool thing, Fabien Doiron implemented the whole thing without jQuery, which I think is just impressive, these days I probably can’t do anything without jQuery anymore …

Published at DZone with permission of Swizec Teller, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Andrew Lombardi replied on Wed, 2012/12/05 - 12:23am

Totally love how simple Alertify.js is. 

Was looking to integrate it with one of our demo apps Mystic Paste .  So we built out an integration between Alertify.js and Wicket with wicket-alertify .

Don't know of anything else that should be added.  Great job on the library!

Stein Morten Hu... replied on Wed, 2012/12/12 - 8:34am

 You can just create a dummy-class when you're not using firebug or equivalent like this:

if (!console) {
    var console = {
        log:function () {
        dir:function () {
        error:function () {

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.