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

  • SEARCH
  • Home
  • 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 7536001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:27:17+00:00 2026-05-30T06:27:17+00:00

When a user edits a record in my application I track that they have

  • 0

When a user edits a record in my application I track that they have it ‘locked’ to prevent another user from editing it until the first user closed the window (or saves).

I’m trying to send the request back to the server to unlock the record but it’s not working in Firefox. The onbeforeunload event is called in script but it’s not sending back the request to the server.
Any ideas?

<body>
<script>
    window.onbeforeunload = function (e) {
        doUnlock();
    }

function doUnlock() {
    if (navigator.appName == 'Microsoft Internet Explorer') {
        // works in IE (with an IFRAME)
        utilFrame.location.href = "/unlock.do?recordId=" + recordId;
    } else if (navigator.appName == 'Netscape') {
        // None of this works....
        //window.location.href = "/unlock.do?recordId=" + recordId;
        var req = newXMLHttpRequest();
        req.open("GET", "/unlock.do?recordId=" + recordId, true);
        req.send();
    } else {
        // Works for chrome
        window.open("/unlock.do?recordId=" + recordId);
    }
}

</script>
  • 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-05-30T06:27:19+00:00Added an answer on May 30, 2026 at 6:27 am

    Add a space between new and XMLHttpRequest.

    On page unload, any pending (AJAX) requests are *cancelled. If you have to send an AJAX request to the server on unload, use a synchronous request (not recommended!!!):

        var req = new XMLHttpRequest();
        req.open("GET", "/unlock.do?recordId=" + recordId, false); // false
        req.send();
    

    I do not recommend the synchronous request, because the user interface blocks until the request has finished. That’s not very user-friendly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MDI application written in Delphi 2007. If the user exits a
I have made a simple Rails application that allows people to comment on posts.
I have two ASP.NET sites that are used for managing patient information. One application
I'm having a strange problem here... I have an ASP.NET 3.5 application that has
I have a simple page in a PHP/MySQL web application that lets admin users
Imagine to have a Desktop application - could be best described as record keeping
I have a data-mining application that accesses a web-site to retrieve records on an
I have been developing an application that uses Models that are based on a
I am researching security frameworks for an ASP.NET MVC3 application that would have some
I have an application for which I would like to record some statistics for

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.