Connecting Tech Pros Worldwide Help | Site Map

Form doesn't submit onUnload in Netscape

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 10:41 AM
Yashwant
Guest
 
Posts: n/a
Default Form doesn't submit onUnload in Netscape

Dear Netscape/Javascript/Java gurus,

I am trying to submit a form onUnLoad when the user accidentally
closes the browser before clicking on a link to complete the
transaction.

On IE, this works fine.
But on Netscape or Mozzilla browsers, the form would simply not submit
when
the browser is closed.

here is the code.
<script language="JavaScript">
function CheckWindowClosed() {
document.MyForm.submit();
}
</script>

<body onLoad="FunctionHandler();" onUnload="CheckWindowClosed();">

Kindly let me know if there is any workaround or fix where I can get
this working on Netscape.

Thanks and Regards,
Yash

  #2  
Old July 23rd, 2005, 10:41 AM
Andrew Thompson
Guest
 
Posts: n/a
Default Re: Form doesn't submit onUnload in Netscape

On 3 May 2004 10:02:31 -0700, Yashwant wrote:

comp.lang.java.programmer,
comp.lang.javascript,
netscape.public.mozilla.general,
netscape.public.general

Please do not cross-post so widely in future
<http://www.physci.org/codes/javafaq.jsp#xpost>
[color=blue]
> Dear Netscape/Javascript/Java gurus,[/color]
.....[color=blue]
> <script language="JavaScript">[/color]

You have the wrong group.
<http://www.physci.org/codes/javafaq.jsp#js>

But then, I notice in your wild cross-posting
that one of the groups is actually the correct one.

Invalid group 'netscape.public.general'
dropped from cross-post.

F'Ups set to the correct group.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
  #3  
Old July 23rd, 2005, 10:41 AM
Brian Genisio
Guest
 
Posts: n/a
Default Re: Form doesn't submit onUnload in Netscape

Yashwant wrote:
[color=blue]
> Dear Netscape/Javascript/Java gurus,
>
> I am trying to submit a form onUnLoad when the user accidentally
> closes the browser before clicking on a link to complete the
> transaction.
>
> On IE, this works fine.
> But on Netscape or Mozzilla browsers, the form would simply not submit
> when
> the browser is closed.
>
> here is the code.
> <script language="JavaScript">
> function CheckWindowClosed() {
> document.MyForm.submit();
> }
> </script>
>
> <body onLoad="FunctionHandler();" onUnload="CheckWindowClosed();">
>
> Kindly let me know if there is any workaround or fix where I can get
> this working on Netscape.
>
> Thanks and Regards,
> Yash[/color]

This is not a good way of doing things. If the user clicks on a link,
do you want to also submit the form? Chances are that when your user
presses the submit button, this handler will also fire -- redundant.

Do you really want to submit data if the user closes the browers? This
goes against usability expectations. I expect that whenever I press the
X in the upper-right corner, that my browser will close, and I will not
send anything off.

Most likely (and I have not looked into it), Netscape is not sending it
on, because it is recognizing that the user wants to close the browser.
Why would it want to navigate to a new page, if the browser is being
closed? It is counter-intuitive.

Then again, you may have a perfectly good reason for doing this, that I
cannot think of. Explinations are welcomed.

Brian

  #4  
Old July 23rd, 2005, 10:42 AM
Dave Monroe
Guest
 
Posts: n/a
Default Re: Form doesn't submit onUnload in Netscape

iamr00t1974@hotmail.com (Yashwant) wrote in message news:<8e02b1f3.0405030902.18b1940b@posting.google. com>...[color=blue]
> Dear Netscape/Javascript/Java gurus,
>
> I am trying to submit a form onUnLoad when the user accidentally
> closes the browser before clicking on a link to complete the
> transaction.
>
> On IE, this works fine.
> But on Netscape or Mozzilla browsers, the form would simply not submit
> when
> the browser is closed.
>
> here is the code.
> <script language="JavaScript">
> function CheckWindowClosed() {
> document.MyForm.submit();
> }
> </script>
>
> <body onLoad="FunctionHandler();" onUnload="CheckWindowClosed();">
>
> Kindly let me know if there is any workaround or fix where I can get
> this working on Netscape.
>
> Thanks and Regards,
> Yash[/color]

The comp.lang.java.programmer posting suggests that you believe that
javascript and java are somehow the same thing. Not true.

Your issue is with javascript.

Use a button and the 'onClick=CheckWindowClosed()' event handler.
  #5  
Old July 23rd, 2005, 10:42 AM
Michael Winter
Guest
 
Posts: n/a
Default Re: Form doesn't submit onUnload in Netscape

On 3 May 2004 10:02:31 -0700, Yashwant <iamr00t1974@hotmail.com> wrote:

[FUs set to clj]
[color=blue]
> I am trying to submit a form onUnLoad when the user accidentally
> closes the browser before clicking on a link to complete the
> transaction.[/color]

Then show a warning clearly on the page that closing the browser before
finishing the transaction will cause them to lose all their information.
[color=blue]
> On IE, this works fine.
> But on Netscape or Mozzilla browsers, the form would simply not submit
> when the browser is closed.[/color]

Why should it? The browser is closing. It doesn't make sense for an
application to do anything more than internal clean-up operations when the
user closes it. Initiating another round of HTTP requests should be out of
the question. Moreover, you do realise that browsers like Opera don't even
fire the unload event when they close.
[color=blue]
> here is the code.
> <script language="JavaScript">[/color]

Though this is the least of your worries, that should read

<script type="text/javascript">

The type attribute is required, whereas the language attribute is
deprecated and should no long be used.

[snip]

Good luck,
Mike

--
Michael Winter
M.Winter@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.