I want to display a conformation pop up, when user tries to leave the page (close the tab) asking him/her "You want to leave the page? Yes No". When the user click the NO, I want to redirect him/her to a specific URL. Here is the code I have tried:
$(window).on('beforeunload', function(){
$.Zebra_Dialog('Are you sure to leave the page?', {
'type': 'question',
'title': 'Conformation',
'buttons': ['Yes', 'No'],
});
$("html").on("click",".ZebraDialog_Button_0",function () {
window.location.href = "http://www.google.com/";
});
$("html").on("click",".ZebraDialog_Button_1",function () {
return true;
});
//return false;
});