Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q546 Why must I set a timeout delay when submitting a form before closing the window - what is this delay accomplishing?

irt.org | Knowledge Base | JavaScript | Timeout | Q546 [ previous next ]

Q546 Why must I set a timeout delay when submitting a form before closing the window - what is this delay accomplishing?

<form onSubmit="setTimeout('window.close',5000)">
<input type="submit" value="Close Window">
</form>

Because JavaScript has no way of knowing when the form has finished beinging submitted - therefore a guesstimate of the amount of time required for the form submit is chosen (5 seconds) and a time is set up to close the window after 5 seconds has passed. However, on a slow day the form may still not have been submitted within the 5 seconds, the closing of the window will interrupt the form submission and it will fail.

Feedback on 'Q546 Why must I set a timeout delay when submitting a form before closing the window - what is this delay accomplishing?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.