19

I found a strange issue. Open a simple page in Firefox, the code is simple as below:

<html>
  <body>
    <textarea></textarea>
  </body>
</html>

In Firefox, I type some characters in the textarea. Then I click refresh button of the browser. Surprisingly, after the page refreshed, what I typed is still there in textarea. However, if I just focus on URL bar and press ENTER key, the textarea is clear after refreshing.

I reproduced this in Firefox 3.6.12 in Linux and 3.6.3 in MacOS. And, I have only Firebug extension installed so it should NOT be due to Firefox extension.

Is this a know issue? How to make textarea clear after Refresh button is clicked?

Morgan Cheng
  • 73,950
  • 66
  • 171
  • 230
  • You sound surprised, but this isn't new behavior. Firefox has done this for as long as I can remember (and I've been using Firefox since its version numbers started with "M"!). – Ken Nov 24 '10 at 05:42

3 Answers3

26

For textarea only:

<textarea autocomplete="off"></textarea>

For all form fields

<form autocomplete="off">

Preventing Firefox from remembering the input value on refresh with Meta tag

Community
  • 1
  • 1
r92
  • 2,800
  • 2
  • 19
  • 24
2

It's so that your form information is kept if you accidentally navigate away from the page and then return by using the previous or next button.

-1

Use

<script>document.form.reset();</script>

or

onload="document.FORMNAME.reset();

which will avoid aufill on refresh.

Conner
  • 30,144
  • 8
  • 52
  • 73
ArK
  • 20,698
  • 67
  • 109
  • 136