Collections:
Other Resources:
Popup Windows Triggers When Pages Are Unloaded without Using onunload Attribute
How to trigger popup windows automatically when pages are unloaded with JavaScript, but not using onunload attribute on the BODY tag?
✍: FYIcenter.com
If you want to generate a popup window whenever a Web page is loaded, you can assign a predefined function to the onunload property of current window object. See the following JavaScript code outline:
<script language="JavaScript">
/*
* Popup Blocker Test - P_WINDOW_ONUNLOAD
* - Popup Windows Triggered by Page Unloading Events
*
* A popup window shows up when a page is unloaded from the
* browser. JavaScript codes implemented on the onunload
* event of the window object.
*
* Version of 2007.01.01
* Download at http://sqa.fyicenter.com/tools/
* Copyright (C) 2007 FYIcenter.com. All rights reserved.
*/
window.onunload = pWindowOnunloadTest;
function pWindowOnunloadTest() {
fyicenterWin = window.open('', 'Popup', 'toolbar=no,sc...
fyicenterWin.document.write('<html><body bgcolor="#eee...
fyicenterWin.document.write('<p><b>P_WINDOW_ONUNLOAD Test...
fyicenterWin.document.write(' - Popup Window Triggered...
fyicenterWin.document.write(' - Developed by FYIcenter...
fyicenterWin.document.write('<p><img src="/popup_test_f...
fyicenterWin.document.write('If you see this popup win...
fyicenterWin.document.write('</body></html>');
fyicenterWin.document.close();
}
</script>
You can also visit Popup Blocker Test - P_WINDOW_ONUNLOAD page to get the complete source code and to see how it works.
2007-01-17, ≈10🔥, 0💬
Popular Posts:
Can I disable Windows service "OracleJobSchedulerXE" to speedup my computer? Third party application...
What are the commonly used background processes on Windows systems? A background process is a progra...
How to use "query user" to find out who is logged in to my Windows 7 computer? If you allow remote l...
What is "Microsoft Policy Platform Local Authority" in my Windows 7 service list? And how is "Micros...
Understanding HelpSvc.exe, "Microsoft Help Center Service" - part of the "Help and Support Center" a...