Prevent loss of variables when browser reload button is pressed

Yusuf Akyol picture Yusuf Akyol · Sep 3, 2009 · Viewed 20.9k times · Source

Is it possible to keep my (global) variables when the page is reloaded? If yes, how?

Thanks for any help. Best regards.

Answer

ben picture ben · Apr 8, 2011

Try this cookie-less javascript function.

It basically store your data in the window.name property which does not clear the value when you reload the page or goes to another site.