htmlinputcheckboxchecked

Checkbox still checked hitting the back button, but it has no "checked" attribute


I am working on a checkbox-based filter for a e-commerce. Everything works fine but when I attempt to go back via the back button, the checkboxes still checked without any checked attribute.

I noticed that this "issue" is occurring on :


The only way I found is just to reload the page. But the "user-went-back" event doesn't seems to be catchable, and I don't want to refresh every single page.

Setting all my checkbox to default makes no sense.

Disabling Chrome cache has no effect.


I don't know if samples of my code would be useful

EDIT : it's my very first post so make sure to tell me why my question seems unclear


Solution

  • There's a crazy trick to fix this problem. Add autocomplete='off' to your checkboxes. Sounds crazy, but it works!