Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Google Chrome on iPad Saves Session ID After Close

Posted on 2015-01-15
5
Medium Priority
?
360 Views
Last Modified: 2015-01-22
My experience in the past has been that when you close a browser it deletes the sessionID in php.

But with Google Chrome on the iPad I am noticing that the sessionID is maintained and is not reset. It appears to be saving the sessionID as a cookie and reuses the sessionID even if you close the browser.

My application stores data in a database based on the session ID so this creates a problem for me.

Is there a workaround that would:

a) Keep the same sessionID within a browser session even if you go to a different site. If you come back to the site, the same ID would be used.

b) Keep the same sessionID if you open a second tab on the site.

c) Delete the sessionID if you close the browser.

Or am I missing something really big here with how sessions are supposed to work.

Thanks.
0
Comment
Question by:pkonstan1
  • 2
  • 2
5 Comments
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 600 total points
ID: 40551949
The sessionID cookie should remain as long as Any window of the browser is open.  They only expire when ALL browser windows are closed and the program exits.
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 450 total points
ID: 40552009
If old session id is a problem then associate it on the database with a timestamp and if the client comes to the server with an old session then replace it with a new one. You have resource and cognitive control from the server side. You never let the control of a session in which there are possible DB updates to be controlled by the client.

Cd&
0
 

Accepted Solution

by:
pkonstan1 earned 0 total points
ID: 40552347
I agree with both of your comments and that has been my practice and experience for ten years. But i noticed today that the behavior on my iPad was different in that even if Google Chrome was totally closed on the iPad, the session ID was saved as a Cookie. So the next time I opened it up, it loaded that session from the cookie.  I did the following as an experiment to test.

1. Opened up my site and loaded a page or two.
2. Closed the browser completed.
3. Put two lines of code in a php page test.php page.  
print_r($_COOKIE); die ("at stop point");

Open in new window


If I follow these three steps on my desktop, I get an empty cookie.
When I do it on my iPad I get an array returned [0][PHPSESSIONID] jufieefjei7879ef89w7598739

It could be that my iPad also has some other Google things like a search and maps. So if they're based off the same environment maybe that's why the cookie is staying persistent... its as if the browser isn't "really" closed unless all of those other process (as well as maybe some background processes) are killed as well.

What do you think?
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40552463
Sounds very likely to me.  Google likes to keep thing running the 'background'.  Chrome on the desktop has an option that you can uncheck to stop allowing it to run things after the browser is closed.
0
 

Author Closing Comment

by:pkonstan1
ID: 40563901
Ultimately it was what I had originally suspected. The two contributors gave some insight that was helpful but it simply brought me back to my original thoughts.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question