Restore backplane feature classes in Firefox

  • I have a form. Initially, the input element has a class of "empty". When the form fills, I dynamically delete the class.

  • The form is submitted and redirected to another page.

  • I press the back button and return to the original form, but the element does not have a "blank" class.

This is not a problem in IE8. I tried adding this jQuery call, but it fails when the page is reached using the back button:

$('#my_input').hasClass('unfilled') 

Thanks!

Edit: Added the wrong line of code above, sorry. Must be:

 $(document).ready(function() { $('#my_input').addClass('unfilled') 
0
source share
2 answers

Firefox supports something called bfcache ( read further here ), which basically caches the entire state of the page in memory and restores it when you return. onload scripts are not executed again, and the elements remain in the same state as before. You can disable this behavior by adding the onunload dummy to your page.

+1
source

Firefox maintains state when you return, which is very convenient on heavy DHTML pages (if you created a dialog, for example, this dialog will still be there when you return). You just need to consider this in your code; for example, you can try adding an onready handler that adds a β€œblank” class to all input elements, for example.

 $(function() { $("INPUT").addClass("unfilled"); }); 
0
source

All Articles