January 2007 - Posts
I found
this blog that addresses my concern in IIS 5.1 for Windows XP. I recently discovered that it is crippled in such a way that it only allows 10 concurrent connections. Moreover, it is hardcoded to be configured to at most 40. If the maximum concurrent connections have been reached, your website's users will receive the following error:
HTTP 403.9 - Access Forbidden: Too many users are connected
The workaround involves modifying the maximum allowable connections to 40. Still, you're stuck at 40.
I needed to do some routines when a user has closed the window. I do not want those routines to trigger when refreshing the page or unloading the document; I just need them to happen when the browser window is closed.
This is the usual proposed solution: assign a function on the
onbeforeunload event of the body or window. The problem with this is it also triggers when refreshing or moving away from the page (i.e. back or forward). I stumbled upon a solution that proposes tapping the
onunload event instead. Thus, I have a function like this:
function body_unload() {
if (window.event.clientX 0) {
alert("The user is closing the window.");
} else {
alert("The user is refreshing or navigating away.");
}
}
I then assign this to the
onunload event of the body. From there I could perform my JavaScript and/or AJAX routines.
Although this works for my purposes, the main downside of this is that I cannot issue a confirm dialog. The page has been unloaded at this point.
In Internet Explorer, when you use window.close() in JavaScript to close the current browser window, you will be asked something like "A script is attempting to close this window. Do you want to continue?" As a programmer, this can be annoying if you are
un-maliciously closing the window. A workaround to this would be setting the
window.opener property to something else.
Example:
In your JavaScript, have something like:
function logoff() {
if (confirm("Do you want to log off?")) {
window.opener = "x";
window.close();
}
}Then in your HTML, have a button or link that calls this JavaScript function onclick.