Consider two web pages with the following in their body, respectively:
<body> <script> document.writeln('<textarea></textarea>') </script> </body>
and
<body> <script> var t = document.createElement('textarea'); document.body.appendChild(t); </script> </body>
(think of them as something more where text fields should be generated from JavaScript and cannot be hardcoded on the page). They both produce the same result, but the former is considered βbad,β and the latter is considered the βrightβ way to do it. (Right?)
On the other hand, if you print something on the page, and then refresh it or go to another place and click "Back", then in the first case, what you typed in the text box is saved, and later it is lost. (At least on Firefox.)
Is there a way to use the latter method and still have a useful function that the user enters into the form is saved even if they accidentally get an update or return using the back button (at least in Firefox)?
javascript firefox usability
ShreevatsaR
source share