Window properties such as the
window.screenTop property and the
window.screenLeft property do not work in Windows Internet Explorer 7. This behavior differs from the behavior of Microsoft Internet Explorer 6.
For example, in Internet Explorer 7, the following code does not cause a message to appear when you close a browser window:
<html>
<script>
function closeHandler() {
if (window.screenTop > 9000 && window.screenLeft > 9000) {
alert("The window will be closed");
}
}
window.onunload = closeHandler;
</script>
<body>
Test page
</body>
</html>
To determine when the browser window is closing, use any of the following methods:
- Use a modal dialog box as the main window.
- Use a parent frameset. Use the onunload event of the parent frameset to determine when the browser window closes.