7

We're using session cookies on our website. After 8 hours they expire. On a desktop browser (Chrome, Firefox, Edge,...) this works just fine.

But on the default Android browser (Chrome) they expire way sooner. (2 hours)

However we make no distinction between desktop or mobile when setting our session-cookie.

Is this default behaviour? And how can we extend the session time on a mobile browser?

(Tested on Android 7.1.2 with Chrome 60.0.3112.116)

But other users on other mobile devices are experiencing the same issue.

J-B
  • 93
  • 2
  • 5
  • First thing, just to be clear, Chrome is not the default android browser. Now, about the issue, have you tried to open Chrome, open your site, keep the phone screen on (prevent to go to the lock screen) and leave the browser always in foreground (not go back to android home screen) for, let's say, 3 hours? I suspect that your problem is that the browser instance are closed by the OS and when you open again the browser you are opening also a new session. – anemomylos Sep 13 '17 at 14:11
  • Tried to keep the phone screen on and you're right. The sessions does not expire. I tested this on an iPhone 6 and there too the session was still valid after several hours. Is there a way to have the same behaviour in Android too? – J-B Sep 14 '17 at 10:52

1 Answers1

4

I suspect that your problem is that the browser instance is closed by the OS and when you open again the browser you create a new session server side. You can't do anything about this. Is like when you close the browser in a computer: when you reopen the browser and open the site you create a new session.

You have to consider to create and use a cookie that lives more than a session cookie and save in that cookie some data that can help you recognize the user. And remember that data stored on the session server side will not be available when the previous scenario occurs.

anemomylos
  • 546
  • 1
  • 6
  • 14