- Posts: 59
- Thank you received: 3
Ask the community, share ideas, and connect with other LimeSurvey users!
$(document).on('ready pjax:scriptcomplete',function(){ /** * Code included inside this will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute * @see https://learn.jquery.com/using-jquery-core/document-ready/ */ }); //FEATURES: (2015-03-27) Now with fix for iframes (e.g. file uploader) and the template editor 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 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 //e.stopPropagation works in Firefox. if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } return 'Are you sure you want to quit this survey?'; // 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'); }); (window).on('beforeunload', function(){ var c=confirm(); if(c){ return true; } else return false; });
You cannot override the iPad browser behaviour.Do you have any suggestions how to change the just mentioned behavior?
This is the expected behaviour. The MDN documentation for the beforeunload event states "Note: To combat unwanted pop-ups, browsers may not display prompts created in beforeunload event handlers unless the page has been interacted with, or may even not display them at all."Also, no warning is shown on PC if users close their browser/tab, unless they scroll down a bit first.
$(document).on('click', '.button, .changelang, .dropdown-toggle, [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'); });