Javascript

Smoke.js - Javascript Alert System Replacement

Written by Kevin Liew on 22 Mar 2012
22,171 Views • Shares
3 comments

Introduction

Smoke.js is a replacement of browser's default alert system for Javascript. If you want to standardize Javascript alert box across different browsers and platforms, Smoke.js is the plugin you are looking for. Smoke.js is a lightweight and flexible Javascript plugin that does just that - replace the existing alert, confirm, prompt and a new addition - signal which display an alert box and hide it after a few seconds. It's fully made with HTML and CSS3 so you will able to style it up and make a custom alert box that visually matched with your website.

Features

  • Signal: Message appear for a few seconds
  • Alert: Normal alert box
  • Confirm: Alert box with Yes & No buttons
  • Prompt: Alert box with input field.
  • Support callback event
  • Lightweight, and easy to skin
  • Work on all browsers including Mobile platform (IE6 usable, no animation)

Example

Alert

smoke.alert('This is a normal alert... nothing fancy', {}, function(){
	// oh what now?
});

Confirm

smoke.confirm('You are about to destroy everything. Are you sure?',function(e){
	if (e){
		smoke.alert('OK pressed');
	}else{
		smoke.alert('CANCEL pressed');
	}
});

Prompt

smoke.prompt('what\'s my name?',function(e){
	if (e){
		smoke.alert('my name is '+e);
	}else{
		smoke.alert('no');
	}
});

Signal

smoke.signal('this goes away after a few seconds... 5 seconds in fact');

SPECIFICATIONS & DOWNLOAD

  • Official Website / Demo / Download
  • Plugin Category: Form
  • Requirement: CSS3 Support
  • Compatibility: Most Browsers including IE6 (Except CSS3 Visual Effect)
  • License: MIT License
Join the discussion

Comments will be moderated and rel="nofollow" will be added to all links. You can wrap your coding with [code][/code] to make use of built-in syntax highlighter.

3 comments
Hasmukh 3 years ago
Hi, Prompt & alert together one behind the other gives me an error of undefined on the latter...Any help on this? great plugin..
Reply
Frankie Kam 3 years ago
Fantastic/ My project went by leaps and bounds after I discovered your post! Was trying other JQuery alert s/w with little success. Smoke.js is so easy to use. Thank you, thank you.
Reply
Carl 3 years ago
Thanks, was looking all over for a non-jquery solution.
Reply