Mobile browser idle will lose variable values

Mobile browser idle will lose variable values

Here's my problem. For desktop, I never had to worry about the javascrip variables losing their values because as long as the page is up and the browser is open, the values are there. But for mobile browsers, after idling for a few minutes, depending on the device, the javascript variable values are all gone, thus leaving my app in a strange state. I can detect if the variable values are gone by setting a test variable value to a known value and then check it to see if the value is still there. But I can't possibly test for variable values lost in every function just to be able to handle this situation. Is there a better way to handle this? Is jquery mobile have a mechanism to handle this?