0

how can we add alert message when user want to reload the page?

when user fill the form and data isn't save then how to prevent from reloading the page

16th Dec 2017, 12:56 PM
Nishat Perveen
Nishat Perveen - avatar
2 odpowiedzi
+ 2
var alert = confirm("The Form Data are not Saved. Do You Still Want to Reload The page?") if(alert==true){ } else{ }
16th Dec 2017, 1:06 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
Try this window.onbeforeunload = function(e) { return confirm("Do you really want to reload the page?"); };
16th Dec 2017, 2:15 PM
Calviղ
Calviղ - avatar