- Posts: 10
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
//e.stopPropagation works in Firefox. if (e.stopPropagation) { alert('Before you leave the survey, please note that.......'); e.stopPropagation(); e.preventDefault(); }
function goodbye(e) { if(!$('body', top.document).hasClass('submitted') && !$('#completed').length && !$('.templateeditor', top.document).length) { //check if a button was used to navigate OR the survey is completed OR the template is displayed in the template editor //e.stopPropagation works in Firefox. if (e.stopPropagation) { alert('Please read the debriefing'); e.stopPropagation(); e.preventDefault(); } return 'Are you sure you want to quit this survey?If you do, please make sure to read the DeBRIEFING Info'; // For chrome } } window.onbeforeunload = goodbye; $(document).on('click', '.button, .changelang, [name="move"]', function(event){ //added .changelang here, please add other classes if you know which should be allowed to navigate $('body', top.document).addClass('submitted'); });
if(!e) e = window.event; //e.cancelBubble is supported by IE - this will kill the bubbling process. e.cancelBubble = true; e.returnValue = 'Are you sure you want to quit this survey?'; //This is displayed on the dialog for IE