5
rated 0 times
[
9]
[
4]
/ answers: 1 / hits: 30728
/ 14 Years ago, wed, october 13, 2010, 12:00:00
I've used window.onbeforeunload
to display a custom message when a user attempts to leave a site.
Example:
window.onbeforeunload = function(){
if(some_condition){
return Are you sure you want to navigate away from this page?nAll unsaved changes will be lost.;
}
};
+--------------------------------------------------------+
| Are you sure you want to navigate away from this page? |
| All unsaved changes will be lost. |
| |
| [ Yes ] [ Cancel ] |
+--------------------------------------------------------+
However, I'd like to enhance this a bit. If possible, I'd like to use a custom modal form instead of the generic popup.
Is there a way to do this?
More From » jquery