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>
</div>
<script type="text/javascript">
   function codingtip_confirm(){
           if(confirm("Do you want to open http://codingtip.blogspot.com in new tabs ?")){
             var href="http://codingtip.blogspot.com"; 
             window.open(href,"_blank");
            }
   else{
    alert("you clicked cancel");
   }
   }
  
</script>
Hope it make sense ! Good luck !