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 6052465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:55:54+00:00 2026-05-23T07:55:54+00:00

When a user wants to edit a task the file gets locked. When they

  • 0

When a user wants to edit a task the file gets locked. When they save or hit the close button(from the dialog) the file gets unlocked.

However if the user clicks any of these : Back button, forward button, close tab/browser

the file is locked. I have a cleanup scheduler that unlocks all files after X minutes.

However I would love to be able to do one last request to unlock the file so people don’t have to wait X minutes till the task unlocks itself becasue someone decided shut their browser down.

I found this

$(window).unload(function ()
    {
        alert('unloaded');
    });

However I have no clue what browser it supports or if it does everything I require it to do.

  • 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-23T07:55:55+00:00Added an answer on May 23, 2026 at 7:55 am
    window.onunload = function () {
       // has to be synchronous so the function doesn't return immediately
       $.ajax({
          async: false, 
          ...
       });
    };
    

    Synchronous requests aren’t looked upon too highly because they can freeze the UI, but I don’t see any other way if you want to implement this specific behavior. I’m sure you could do it several other ways without requiring a synchronous request however.

    For example, you could ask the user to save the file when they attempt to close the window:

    // use beforeunload to prompt the user
    window.onbeforeunload = function () {
       if (!saved) {
           return "Please save the task before exiting!";
       }
    };
    

    Also, most browsers support these events. I think Opera is an exception though.

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

Sidebar

Related Questions

When the user clicks an Edit button on my form, I want a box
I need to perform a task whenever the user ordinarily ends edit mode (no
I've got a list of things that I want the user to easily edit
I have an input edit field where the user can enter data. I want
Here is the idea: When the user wants to see /controller/action, then I want
All Weather Tickers I found are static and if the user wants to select
I'm using django and realized that when the filename that the user wants to
I'm trying to write a bash script that wraps whatever the user wants to
I have a method that is called addHighScore. When a user wants to quit
Im working with email address which has an ampersand in it, the user wants

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.