Show preloader message when page is unloading


/ Published in: JavaScript
Save to your folder(s)

This works cross browser. Merely using onclick on a submit button to show a preloader/ please wait dialog doesn't work in IE since it doesn't show images once the page is being unloaded.


Copy this code and paste it in your HTML
  1. <script type="text/javascript" src="https://github.com/malsup/blockui/raw/master/jquery.blockUI.js"></script>
  2. <script type="text/javascript">
  3. $(document).ajaxStop($.unblockUI);
  4. $(document).ready(function () {
  5. $('#lnkBtnPrevious').click(function () {
  6. $.blockUI();
  7. });
  8.  
  9. $('#lnkBtnContinue').click(function () {
  10. if (typeof (Page_ClientValidate) == 'function') {
  11. Page_ClientValidate();
  12. }
  13. if (Page_IsValid) {
  14. $.blockUI();
  15. }
  16.  
  17. });
  18. });
  19. </script>

URL: http://jquery.malsup.com/block/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.