onbeforeunload, settimeout and IE

A

Andrew Poulos

The stuff I'm doing requires a number of writes to a db from a form
post. To make sure each form gets posted there's a setTimeout to
introduce a short delay.

When a user clicks the provided 'exit' button everything can happen in a
neat order but when the user click, say, the 'x' button on the title bar
I'm having trouble.

I'm using window.onbeforeunload to catch any exit that isn't via the
'exit' button and an alert pops up to notify the user and, hopefully,
give time (300ms) for the setTimeout to trigger.

Unfortunately only IE seems to stop the setTimeout from triggering. My
code looks a bit like this:

fUpdate = function() {
window.onbeforeunload = null;
fWriteData('notes', notes);
setTimeout("fWriteData('Limit', limit)",300);
alert("wait a mo");
self.close();
};

window.onbeforeunload = fUpdate;

How can I code so that IE will trigger a setTimeout on onbeforeunload?

Andrew Poulos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top