开发者

Enable browsers to "remember" form values when using jquery?

See: http://friendfeed.com/paul/2b7ddce5/jquery-1-3-breaks-bfcache-because-it-binds

I've got a form in my web app, and if the user submits it and presses the browser BACK button the form values are remembered (e.g. any values the user entered).

Once I add jQuery 1.4.2 开发者_如何学运维to the page (e.g. reference it as a script), then this behaviour changes. From what I've read, this happens because jQuery hooks the onunload event, and this is a signal to browsers that the script is not bfcache-aware, so it turns off bfcache.

UPDATE: I looked into this a bit further, and this problem was fixed in jQuery 1.4 it seems. It looks like the problem was caused by the autocomplete plugin I was using, I'll post a resolution if I find one.


For my forms I use an on submit handler to save each form elements value in a cookie, and then pre populate the fields with that data (in PHP side) .. This way the for always keeps the info, even if the person closes the window and then goes back to it.. Or gets distracted and clicks on some other page..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜