Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8568451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:06:57+00:00 2026-06-11T18:06:57+00:00

I am writing for some adivce on a javascript I made for a xhtml

  • 0

I am writing for some adivce on a javascript I made for a xhtml page. I got it to mostly work on IE, FF and chrome (Safari still giving me some grief but thats another subject.) The problem I am having is that IE would run the beforeunload event even when someone is submitting a form which is not something i want to happen because the beforeunload script would cause the information to be reseted. It even does it when I press F5 which isn’t something I want either. Now FF and Chrome aren’t having that problem when the form is submitted don’t know why though. Here is the code I have written so far.

<script type="text/javascript"> 
window.onbeforeunload = function() {
var hiddenBtn = document.getElementById("kioskform:broswerCloseSubmit");
return  hiddenBtn.click();
           }   </script>

Just wondering how to go about this any advice is very appreciated thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:06:59+00:00Added an answer on June 11, 2026 at 6:06 pm

    Define a html hidden variable. Assign a value to when the user submits the form. Then in your unload function, check that hidden variable. If it’s populated with whatever value, then leave the function.

    <script type="text/javascript"> 
     window.onbeforeunload = function() {
      if (document.getElementById("wasformsubmitted").value != "Y") {
        var hiddenBtn = document.getElementById("kioskform:broswerCloseSubmit");
        return  hiddenBtn.click();
      }
    }   
    function SetSubmitVariables()
    {
     document.getElementById("wasformsubmitted").value = "Y";
     return true;
    }
    </script>
    <body>
      <form ... onsubmit="return SetSubmitVariables();">
        <input type="hidden" id="wasformsubmitted" value="N" />
        ... 
      </form>
    </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lately I've been writing some JS code using jQuery and JavaScript as it is
I'm planning on writing some code for encrypting files in javascript locally. For large
I'm writing a JavaScript that generates some data. I intend to use it as
We are writing a socket server in c# and need some advice on the
While writing some C code, I decided to compile it to assembly and read
Im writing some helper functions for a project im working on. I've always wanted
While writing some views to respond to ajax requests i find it somewhat strange
Just writing some CSS and I have a pretty cool Search form where you
So I was writing some queries today and was using top 10 on a
I am re-writing some code for a new re-design and I am wondering if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.