I have a one-page website with sliding panels, some of which have external links. The desired behavior is that when a visitor clicks an external link, they go to it. When they hit the back button, they come back to the panel they were on.
So far I've got this working by keeping the state saved in a cookie.
I'm wondering, though, if it isn't possible to ignore the cookie when the visitor hasn't just used the back button or is coming from a site other than ones linked to by my site. I looked into using history.previous, which seems to have permissions issues, and document.referrer, which doesn't seem to recognize "going back" as a referrer.
Ideas?