Form doesn't submit onUnload in Netscape

Discussion in 'Java' started by Yashwant, May 3, 2004.

  1. Yashwant

    Yashwant Guest

    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
     
    Yashwant, May 3, 2004
    #1
    1. Advertising

  2. 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>

    > Dear Netscape/Javascript/Java gurus,

    .....
    > <script language="JavaScript">


    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
     
    Andrew Thompson, May 3, 2004
    #2
    1. Advertising

  3. Yashwant

    Dave Monroe Guest

    (Yashwant) wrote in message news:<>...
    > 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


    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.
     
    Dave Monroe, May 4, 2004
    #3
  4. On 3 May 2004 10:02:31 -0700, Yashwant <> wrote:

    [FUs set to clj]

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


    Then show a warning clearly on the page that closing the browser before
    finishing the transaction will cause them to lose all their information.

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


    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.

    > here is the code.
    > <script language="JavaScript">


    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
    lid (replace ".invalid" with ".uk" to reply)
     
    Michael Winter, May 4, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yashwant

    Form doesn't submit onUnload in Netscape

    Yashwant, May 3, 2004, in forum: Javascript
    Replies:
    3
    Views:
    110
    Michael Winter
    May 4, 2004
  2. viper81
    Replies:
    1
    Views:
    126
  3. alan_atwood
    Replies:
    2
    Views:
    202
  4. Replies:
    4
    Views:
    115
    Benjamin
    Nov 13, 2006
  5. Replies:
    3
    Views:
    715
Loading...

Share This Page