How can I close a tab of browser after getting confirmation from user?
<p>I want to close a tab after getting confirmation from user. It can be done as follow-</p>

<pre><code>window.onbeforeunload = function() {
       return "Are you sure?";
}
</code></pre>

<p>But the problem with this code is that it shows some message that I am not expecting. I want to do this task using javascript's confirm() popup. can anyone help me to do this.</p>

<p>Thanks in advance.</p>
