I need t开发者_Python百科o show an "Exit" popup window in MOSS pages. How can I achieve this?
- Setup a javascript include for jQuery
- Setup a javascript include file with this code:
var doPopup = true;
$(document).ready(function() {
$('a').click(function() { doPopup = false; });
$('form').submit(function() { doPopup = false; });
});
$(window).unload(function() { onUnloadPopup(); });
function onUnloadPopup() {
if (doPopup) {// do your window.open here }
}
What it does is run the onUnloadPopup everytime the page is exited without clicking either a link or submitting a form. That function can open your exit popup. Be prepared for a lot of issues though. Exit popups are not liked much, browsers will block them and with something as complex as SharePoint you might get some unexpected occurrences..
精彩评论