Where does the browser store user input data?

2.5k Views Asked by At

Where does the browser store user input data like the checkbox selection values, text in textboxes, etc?

For example, after entering some text in a textbox I checked using the inspect element in Chrome but the entered value is not seen there. It is also not in view source on the page. Is it in browser cache?

1

There are 1 best solutions below

2
On BEST ANSWER

They are stored in the DOM. HTML is parsed and stored as data. This data is rendered into what we see in our browser. This data can be accessed and changed using Javascript as well as through interaction with the website (ie. checking boxes, entering text).

WHY YOU DON'T SEE THE CHANGES

  • View source shows the original code that was sent to the browser. It does not show any changes that have been made to the page.
  • The cache stores files (images, js, css, html) you have already downloaded from a server. The next time you go to download those files, your browser can use the files it has already downloaded and saved into the cache rather than downloading them again. This is faster and more efficient. You will not see changes reflected here for the same reasons as View Source.
  • Inspect Element in Chrome does not show the change either. This is because they fail to update their inspector when the DOM has changed. In my opinion this is a bug on their part, but may be required for performance reasons.

HOW TO SEE CHANGES

Open up a console in your browser (most have one built in) and type document.getElementById("id-of-input").value you will see the value printed out.

You should note that you use value and checked for checkboxes.