Last active
December 31, 2015 07:09
-
-
Save pascallaliberte/7952294 to your computer and use it in GitHub Desktop.
FluidSurveys: Prompting the user to "Save and continue later" before closing the window.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Add a question of type "javascript" to your survey (ultra package or higher required) | |
// 2. Paste this code in and edit the message. | |
$(function(){ | |
//place script here | |
$(window).bind('beforeunload', function(){ | |
return 'Just to make sure, did you click "Save and continue later"? We\'re checking because we wouldn\'t want you to lose what you entered.'; | |
}); | |
$('input[type=submit]').click(function(){ | |
$(window).unbind('beforeunload'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One issue: it won't work on the iPad, if the user closes the Safari tab. :/