window.onbeforeunload = function (e) {
	var message = "Are you sure ?";
	var firefox = /Firefox[\/\s](\d+)/.test(navigator.userAgent);
	if (firefox) {
		//Add custom dialog
		var custom_div = document.createElement("div");
		custom_div.innerHTML = message; 
		document.body.appendChild(custom_div);
	}
	return message;
}
@@ -172,131 +172,693 @@
 g%0A%09%09
-var custom_div = document.createElement(%22div%22);%0A%09%09custom_div.innerHTML = message; %0A%09%09document.body.appendChild(custom_div);
+//Firefox does not accept window.showModalDialog(), window.alert(), window.confirm(), and window.prompt() furthermore%0A%09%09var custom_div = document.createElement(%22div%22);%0A        document.body.appendChild(custom_div);%0A        custom_div.style.visibility = %22hidden%22;%0A        custom_div.style.color = %22white%22;%0A        custom_div.style.padding = %2220px%22;%0A        custom_div.style.backgroundColor = %22red%22;%0A%09%09custom_div.style.position = %22fixed%22;%0A%09%09custom_div.style.zIndex = 999;%0A%09%09custom_div.innerHTML = message; %0A        var left = document.body.clientWidth / 2 - custom_div.clientWidth / 2;%0A        custom_div.style.left = left + %22px%22;%0A        custom_div.style.visibility = %22visible%22;        
 %0A%09%7D%0A

Add custom dialog example