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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:36:09+00:00 2026-06-05T01:36:09+00:00

I am currently building a simple ajax interface for a booking and tracking from

  • 0

I am currently building a simple ajax interface for a booking and tracking from for use on the web.

The problem I have is that if the user hits the back button or the refresh button any unsaved data is erased and the page returns to its normal starting position.

I have implemented the basic javascript onUnload function as below:

function winClose()
{
    if (confirm("Are you sure you want to navigate away from this page?"))
    {
         window.close();
    }

    return false;
}

along with the addition of:

<body onUnload="return winClose(); return false;">

This gives the rather clumsy alert box that no-one really likes but it still resets the page to its original starting position.

Does anyone know of a way to implement something similar that does not reset the page and just ignores everything if the user chooses not to navigate away from the page ?

  • 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-05T01:36:10+00:00Added an answer on June 5, 2026 at 1:36 am

    You’d want to store your position (either as an integer or as a JSON array) and the data involved in a cookie (or cookies) on the users browser, as you go along. You can’t always rely on onbeforeunload for this.

    A good jQuery cookie plugin is this: https://github.com/carhartl/jquery-cookie

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

Sidebar

Related Questions

I'm currently building a simple web application in PHP that other company's can use
I'm currently building a simple ecommerce site and have ran into an interesting problem.
Currently I have a simple maven project that is building a jar file and
I am currently building a very small/simple web application in ASP.NET MVC with ADO.NET
I'm currently building a simple app that overlaps one image on top of another.
I've encountered a small problem building a web application. My thinking was simple: application
I have a fairly simple board game i've been building in C++. Currently, players
For a YouTube web-app I'm building in PHP, I have the simple video player,
I'm currently considering building a simple MMORPG. The idea is to have a .NET
I am currently building a simple iOS that that calls a php page on

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.