469,623 Members | 876 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

what happens if I submit a form in the onunload event?

I have an application that will submit the form when the page is closed
(through onunload event), and it works fine in IE6. But it doesn't work
in FireFox, and no data is sent. It seems to me that FireFox doesn't
let the onunload event ends before the window is closed. Or is it an
form submit issue in the onunload event?

Thanks!

Nov 11 '06 #1
5 2541

ja********@gmail.com wrote:
I have an application that will submit the form when the page is closed
(through onunload event), and it works fine in IE6.
Really?
But it doesn't work
in FireFox, and no data is sent. It seems to me that FireFox doesn't
let the onunload event ends before the window is closed. Or is it an
form submit issue in the onunload event?
When you submit a form with the unload handler, you are sending the
browser to a different page. It's a bad idea!
>
Thanks!
Nov 11 '06 #2

"Benjamin д
"
ja********@gmail.com wrote:
I have an application that will submit the form when the page is closed
(through onunload event), and it works fine in IE6.
Really?
But it doesn't work
in FireFox, and no data is sent. It seems to me that FireFox doesn't
let the onunload event ends before the window is closed. Or is it an
form submit issue in the onunload event?
When you submit a form with the unload handler, you are sending the
browser to a different page. It's a bad idea!
Are there any better solutions to this problem? I need to submit the
data when the user close the window. The only thing I can think about
is to provide a button on my page and clicking that button will submit
the data and close the window. But users can still click 'x' to close
the window and data is lost.

Nov 12 '06 #3
VK

ja********@gmail.com wrote:
Are there any better solutions to this problem? I need to submit the
data when the user close the window. The only thing I can think about
is to provide a button on my page and clicking that button will submit
the data and close the window. But users can still click 'x' to close
the window and data is lost.
<http://groups.google.com/group/comp.lang.javascript/msg/a0c582dc42c65fd2>

I would suggests (humbly) to skip on onunload part and use the
sessionID way

Nov 12 '06 #4
On 2006-11-12 18:12:19 +0100, "ja********@gmail.com"
<ja********@gmail.comsaid:
>
"Benjamin 写道:
"
>ja********@gmail.com wrote:
>>I have an application that will submit the form when the page is closed
(through onunload event), and it works fine in IE6.
Really?
>>But it doesn't work
in FireFox, and no data is sent. It seems to me that FireFox doesn't
let the onunload event ends before the window is closed. Or is it an
form submit issue in the onunload event?
When you submit a form with the unload handler, you are sending the
browser to a different page. It's a bad idea!
Are there any better solutions to this problem? I need to submit the
data when the user close the window. The only thing I can think about
is to provide a button on my page and clicking that button will submit
the data and close the window. But users can still click 'x' to close
the window and data is lost.
I dunno what you need to save, but what about an ajax-solution that
makes a backup every x seconds (like in Gmail)?

Nov 12 '06 #5

ja********@gmail.com wrote:
"Benjamin д
"
ja********@gmail.com wrote:
I have an application that will submit the form when the page is closed
(through onunload event), and it works fine in IE6.
Really?
But it doesn't work
in FireFox, and no data is sent. It seems to me that FireFox doesn't
let the onunload event ends before the window is closed. Or is it an
form submit issue in the onunload event?
When you submit a form with the unload handler, you are sending the
browser to a different page. It's a bad idea!
Are there any better solutions to this problem? I need to submit the
data when the user close the window. The only thing I can think about
is to provide a button on my page and clicking that button will submit
the data and close the window. But users can still click 'x' to close
the window and data is lost.
Of the other ideas mentioned (sessions and AJAX), sessions are the most
reliable. Of course these have to be done on the server-side. AJAX is
only supported on the latest browsers.

Nov 13 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Yashwant | last post: by
2 posts views Thread by Floortje | last post: by
11 posts views Thread by antonyliu2002 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.