I am trying to use either BlockUI or jqModal to display a modal dialog when the page unloads but it just won't work (in IE7).
Using jqModal THIS WORKS (attaching to an <a> tag): $().ready(function() { $('#confirm').jqm({ overlay: 88, modal: true, trigger: false }); $('#navigationBlock a').click(function() { confirm('changes have not been saved'); return false; }); }); But THIS DOES NOT WORK (attaching to the unload event): $().ready(function() { $('#confirm').jqm({ overlay: 88, modal: true, trigger: false }); $(window).unload(function() { confirm(''changes have not been saved''); return false; }); }); Using BlockUI, THIS WORKS: $(document).ready(function() { $('#navigationBlock a').click(function() { $.blockUI({ message: $('#question'), css: { width: '275px'} }); }); }); But THIS DOES NOT WORK: $(document).ready(function() { $(window).unload(function() { $.blockUI({ message: $('#question'), css: { width: '275px'} }); }); }); Any advice or suggestions are much appreciated.