Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

400
Views
Why does Safari (both macOS and iOS) randomly drop cookies and local storage?

I have a website where I store an authentication token in a cookie with 5-year expiration. Despite that, both desktop and mobile Safari tends to drop this cookie from time to time (sometime it lasts for 2 months, sometime it gets removed in a week). This is very unpredictable to my users.

I also tried storing the same token in Local Storage instead of a Cookie, the result is exactly the same.

Both the cookie and the local storage item are set by JavaScript / AngularJS on the client side:

window.localStorage.setItem('token', 'secret-token');
angular.module('app', ['ngCookies'])
.controller('Ctrl', ['$cookies', function($cookies) {
  var expireDate = new Date();
  expireDate.setDate(expireDate.getDate() + 5*365);
  $cookies.put('token', 'secret-token', { 'expires': expireDate });
}]);

I haven't found any documentation describing this especially random behaviour.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!