I have a VisualForce page that it is possible to use offline because I am caching the page and other resources in the application cache.
I have a button on that page that will execute a Visualforce remoting method (intended to work when the user is online).
The issue I have is that if the user has started the application while offline, then they won't be logged into salesforce. When they go back online again, the Visualforce remoting function will execute, but because they are no logged in, an error will be returned.
Is there a solid way, using JavaScript, that I could detect whether the user is currently logged into Salesforce?
If so, is there a way that I could determine the page that they go to after they log in? In an ideal world, the remoting method would execute as normal, but I'd settle for returning to the view that they were on when they pressed the button.
Thanks