Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Nikolay Batrakov
Nikolay Batrakov
9,604 Points

remembering user in a session

I've built simple app for remembering users based on User Authentication course. Everything is fun and good but one thing seems weird for me. Chrome doesn't forget user unless I close the browser completely. I mean, exit the application itself not only close the window with my app. Is it "normal" behaviour?

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Are you testing this with a tablet or a phone? What do you mean by "close the window with my app"?

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

I think it's intended behavior - you have one process with many tabs that share this process session cookie; you close the process by closing the whole browser - this link is old, but the answer puts what I wanted to say more clearly:

http://stackoverflow.com/questions/805895/why-doesnt-closing-a-tab-delete-a-session-cookie

Did you test this in Firefox as well?

Nikolay Batrakov
Nikolay Batrakov
9,604 Points

I'm testing it on my desktop, when I close the tab or window, the session sticks with me (stores my user id and thus recognised by rails). It changes a value only when I exit the browser. The same is with Safari. I've followed your link, it seems to be "natural behavior", I wouldn't say that is "desired behavior" :) but... who cares. I wouldn't think that handling the issue in JS would be a good solution so I'll just live with it. :) Thank you.