[Catalyst] Browser window/tab independent sessions

Perrin Harkins perrin at elem.com
Tue Jan 9 13:42:35 GMT 2007


Ian Docherty wrote:
> What is still not clear is how to generate (for all possible ways of 
> opening a new window) a new URL encoded session value. e.g. cutting and 
> pasting a URL from one window into another will also copy the URL 
> encoded session so both windows would have the same state.

It's not a problem.  You have to stop thinking session IDs.  If what you 
have in the URL is things like the current search term, it doesn't hurt 
anything for them to be there when the person copies the URL and pastes 
it into a new window.  The new window's data will change as the person 
uses it, with no affect on the old window.  The only way it can be a 
problem is if you put session IDs in the URL that are tied back to 
server-side state.  Then both windows will be trying to change the same 
server-side state.

In other words, for state information that you keep in the URLs, making 
a new window and pasting the URL into it will instantly split the new 
window's state from the old one.

As someone else pointed out, Apache::Session::Counted can also solve 
this problem, but most people will find it more confusing than just 
putting everything in the URLs.

- Perrin



More information about the Catalyst mailing list