Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control of Firefox's Form Recovery

I have a page that contains multiple checkbox input elements. Toggling these alter the appearance of the page in a way that can only be done in Javascript.

My problem arises when you close and reopen the page. A brief (seemingly inconsistent) moment after the page loads, Firefox restores the state of the checkboxes without raising their onchange events.

Is there a way to determine when Firefox recovers these elements, or at the very least, is there any way to disable this functionality without requiring the users to change their browser settings?

I am also using jQuery, in case that has anything that can help.

Using autocomplete="off" on the inputs has no effect.

like image 261
YotaXP Avatar asked Jul 19 '11 03:07

YotaXP


1 Answers

If you just need to fire the change handlers, to match the page's state to the user's last preference (which seems like a good idea), then something like this should do the trick. :

$(window).load ( function () {
    $('input:checked').change ();
} );


See the demo at jsBin.

like image 111
Brock Adams Avatar answered Sep 30 '22 11:09

Brock Adams