1

I have a form that has a refresh button that uses this code:

<button type="button" onClick="window.location.reload();return false;" style="height:33px; width:50px;">
 <img src="../css/images/restart_25.png" />
</button>

and i've also used this:

onClick="window.location.reload()"

On all other broswers, this button refreshes the entire page, and with the first select set back to <option value="">Select Category</option>

On firefox the page refresh, but the Category Select remains what it was previously selected, for example Test.

Before Refresh on Firefox:

enter image description here

After Refresh Button Clicked on Firefox:

enter image description here

After Refresh Button Clicked on all other browsers:

http://puu.sh/6AtSQ.png

I'm not sure if it matters but, this category select is attached to ajax code which searches for the selection picked by the user and outputs the next selection of options, if the code is needed, i will display it.

Why does Firefox not refresh the entire form and all other browsers do? Thank you.

Outdated Computer Tech
  • 1,996
  • 4
  • 25
  • 39
  • You could try something like the [solution here](http://stackoverflow.com/questions/2486474/preventing-firefox-from-remembering-the-input-value-on-refresh-with-meta-tag): which uses autocomplete=off to prevent firefox from doing this with inputs, not sure if it does it for selects though. – Patrick Evans Jan 27 '14 at 21:27

3 Answers3

1

There is an attribute that you can use for an input, select and form elements. Set it to off, like this:

<select autocomplete="off">...</select>

or

<form autocomplete="off">...</form>

or

<input autocomplete="off" />

Check out the reference HERE

Alex Shilman
  • 1,547
  • 1
  • 11
  • 15
1

Here's the trick:

window.location.reload(true);

The reload method has a boolean value, which, when it is true, causes the page to always fetch document from the server. It defaults to false, which may reload the page from the cache.

Skwal
  • 2,160
  • 2
  • 20
  • 30
1

You can use document.location.reload() instead of using window.location.reload() because Firefox has issues refreshing the page using JavaScript window.location.reload().

Read this article

Or If you want to use window.location.reload() then you can try to set attribute to true.

window.location.reload( true): Force reloading the current page from the server.

Ishan Jain
  • 8,063
  • 9
  • 48
  • 75