Window confirm javascript method display a dialog box with a message belong to OK and CANCEL
 button. For some special event, we should you confirm dialog to help user does not do something wrong.

Demo for Windows confirm Method

Just CLICK on following button to display the confirm box :

Just take a look at Source code:

<div style="text-align: center;">
<button onclick="codingtip_confirm()">click ME Plz !</button>
<script type="text/javascript">
   function codingtip_confirm(){
           if(confirm("Do you want to open in new tabs ?")){
             var href=""; 
    alert("you clicked cancel");
Hope it make sense ! Good luck !