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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:15:28+00:00 2026-06-13T10:15:28+00:00

what exactly is happening when PHP is putting contents (1 MB for example) in

  • 0

what exactly is happening when PHP is putting contents (1 MB for example) in a file and the user closes the tab?
Could the file be corrupted? How can I avoid that?
Thanks a lot

  • 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-13T10:15:29+00:00Added an answer on June 13, 2026 at 10:15 am

    This is more a client-side issue…

    I solved this problem using Javascript’s window.onbeforeunload and window.onunload functions:

    <head>
    <script>
    var invalid_exit=0;
    var submitted=0;
    
    window.onbeforeunload = function(){ 
        if (invalid_exit==1  && submitted==0 ){
            return 'You will lose your progress!';
        }
    }
    
    window.onunload = function(){ 
        if (invalid_exit==1  && submitted==0 ){
        //ajax call when an invalid exit is happening...        
        }
    </script>
    </head>
    

    In this case, I used to control variables: invalid_exit and submitted….

    You can check if a user clicks a submit button(submitted=1), closes the browser(invalid_exit=0), refreshes the page(invalid_exit=0), etc… Depending on your requirement….

    With Jquery you can control every event…

    I hope this can help you out!!!

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

Sidebar

Related Questions

I am not sure exactly is happening here but did figure out that URLLoader.close();
I'm working a web application with PHP. Something wrong is happening that I have
Can someone explain what exactly is happening at a low level / memory management
I've been trying to figure out what exactly is happening here. I'm just trying
I am not exactly sure what's happening here - I open a terminal window
I'm not sure exactly where this is happening, but what I'm trying to do
Exactly when are an Activity 's fields that are annotated with @InjectView or @InjectResource
languages used: html, javascript/jquery, and php 5.2 So I created this function that onclick
Possible Duplicate: Can't decode JSON string in php I'm at my wits end here,
What exactly is happening here? #include <boost/array.hpp> #include <boost/assign/list_of.hpp> struct Toy { int m_data[100000];

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.