关闭浏览器之前显示自定义弹出窗口

I need a java-script or jquery code so that when every only I close my browser or tab of the browser then my custom popup from will come out, I don't want browser's default massage . I want to hide the default massages of the browsers only my popup form will be displayed before closing. And it need to be supported in three major browsers IE9,Firefox,Crome. Again I am mentioning the default messages which comes from browsers which have two options 1.leave page 2.stay on page I want to hide them

Thanks in Advance,

No, that is not possible - and thats for a good reason!

Imagine, everyone could hide these messages from Browser, it would be a paradise for every criminal!

You can pop a dialogue on .unload(). Last I checked this was supported on IE/FF/Chrome/Safari but not Opera.

As for hiding the buttons to confirm that you want to leave the page or not, those can not be hidden or removed. As Haudegen said, for very good reason.

jQuery:

$(window).bind('beforeunload', function(){ 
    return 'Dialog text here.';
});

JavaScript:

window.onbeforeunload = function(e) {
  return 'Dialog text here.';
};