Hello all am trying to redirect user to redirect to another page when user decides to reload if he is asked for confirmaton. The function are getting executed but the window.location.href seems not to be working.
window.onbeforeunload = function () {
return "Are you sure?";
}
window.onunload = function () {
submitexamonunload();
console.log("Too bad. Goodbye.");
}
function doneexam(){
if($("#std_store_exam").data("type") == "demo"){
console.log("Into done exam."+$("#std_store_exam").data("type")+"inner");
window.location.href = "demoexam.php";
}else{
storeres();
window.location.href = "studentdashboard.php";
}
Tried some options availabe and researched also. Any help is appreciated.