tr0y Posted March 23, 2014 Share Posted March 23, 2014 Hi noob here coming from a business analyst background and trying to become more useful to developers. Please bear with me. I am working on the functional specifications of a web application ( PHP / MySQL ) that allows users to upload large quantities of files in bulk using plupload, sometimes numbering into the thousands of files. What I am trying to learn and understand is how to warn a user if they click any other link on the page, internal or external, that the upload may fail and that they should not navigate away. I have been able to warn them if they are going to close the window or tab, but not if they are going to click a link on the page. I have attached a screenshot with the warning dialog when you close the page but am trying to pop that up with the click of any link on that page. This may not be the right forum for this question, sorry for my noobishness if this is an the wrong place. Thanks ! Quote Link to comment https://forums.phpfreaks.com/topic/287206-warning-message-on-navigate-away-noob-question/ Share on other sites More sharing options...
Skewled Posted April 12, 2014 Share Posted April 12, 2014 (edited) <script> $(document).ready(function() { $("a").click(function(e) { e.preventDefault; var c = confirm('If you leave your upload may fail.'); if (c == false) return false; }); }); </script> This will alert on any link clicked on the page and if they click ok they will be able to follow the link or if they click cancel it won't do anything. Edited April 12, 2014 by Skewled Quote Link to comment https://forums.phpfreaks.com/topic/287206-warning-message-on-navigate-away-noob-question/#findComment-1475850 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.