How to show a jquery ui dialog at page reload?
<p>I want to show a jquery ui dialog , if user will reload, close the browser. I tried :</p>

<pre><code>$(window).bind('beforeunload', function () {
    $("#confirm").dialog({ width: 500, modal: true,
        buttons: {
            "Ok": function () {
              // let the page reload
            },
            "Cancel": function () {
                // cancel reloading the page
                $(this).dialog('close');
            }
        }
    });
});
</code></pre>

<p>But the page is reloading without showing confirmation dialog. If i put a return statement then it shows a general alert message. But i want to show a dialog. How can i do this ?</p>
