Skip to content Skip to sidebar Skip to footer

What Happens To Form / Javascript Data When Browser Window Is Closed?

I have a html form which collects data in input elements and then generates a PDF (using jsPDF) for the user to download (using Downloadify js). The data collected contains person

Solution 1:

Yes it will probably remain in memory for a period. This is beyond you control, and will differ between browsers and operating systems.

If your form is not actually submitted to the server, autocomplete should not store it, although you may want to add autocomplete="off" to be extra sure of this.

You could also use JavaScript to set the form values to blank once processing is done.

document.getElementById('name').value = '';

You could also set any JavaScript objects to null after use. This will not guarantee that the data would not be held in memory somewhere. You could encourage users to close all browser windows after use and logout of the operating system if this is a concern. Browsers such as Chrome can remain in memory even though all windows are closed as it can live in the system tray if that option is set so logging out will force it to close whilst being easy for users to do.

Solution 2:

Yes. The form data is saved in browser memory even if the user navigates to other page or closes the tab. It will saved in temporary browser auto-fill cache. You can disable this by using the attribute autocomplete="off" for form elements.

You can find more about autocomplete attribute here: http://www.w3schools.com/tags/att_input_autocomplete.asp

Solution 3:

  1. Set autocomplete off. Auto fill will not save if this Is set.
  2. Set Cache Headers in the response to not cache. Browser will not cache the page and discard when closed.

Post a Comment for "What Happens To Form / Javascript Data When Browser Window Is Closed?"