iOS 11 deletes all cookies when closing browser

2 min read 06-10-2024
iOS 11 deletes all cookies when closing browser


iOS 11 Cookie Crumble: Why Your Browser Keeps Forgetting You

Ever logged into your favorite website on your iPhone, only to find yourself re-entering your credentials the next time you open the browser? This frustrating experience is a common side effect of a change in iOS 11, where the operating system now deletes all cookies when you close your browser.

Let's break down why this happens and explore the potential workarounds.

The Cookie Conundrum: iOS 11's Privacy Focus

Apple's iOS 11 introduced a new privacy-focused approach to cookie management. The intention was to give users more control over their online data and reduce the tracking capabilities of websites. This change, however, resulted in an unexpected consequence: the deletion of all cookies upon closing the browser.

Here's the original code snippet that exemplifies this behavior:

// Inside the SafariViewControllerDelegate's webView(_:didFinishNavigation:)
// ...

// Remove all cookies for the current session
let websiteData = HTTPCookieStorage.shared.cookies(for: URL(string: "https://www.example.com")) ?? []
HTTPCookieStorage.shared.deleteCookies(websiteData) 

The above code demonstrates the aggressive cookie clearing mechanism implemented in iOS 11. This behavior, though intended for privacy, can cause annoyance for users who prefer to remain logged into websites across browsing sessions.

Understanding the Impact

This change has several implications for users:

  • Frequent logins: You'll find yourself re-entering login credentials every time you open the browser, even for websites you frequently visit.
  • Session loss: Any progress you've made on websites that rely on cookies, like online shopping carts or form submissions, will be lost upon closing the browser.
  • Preference resets: Personalized settings like website preferences or language choices might be lost, requiring you to reconfigure them every time.

Potential Workarounds

While iOS 11's cookie management can be frustrating, there are a few ways to mitigate the issue:

  • Use Incognito Mode: Incognito mode in most browsers prevents the storage of cookies and browsing history, effectively "forgetting" your activity. While this might be helpful for privacy, it's not a solution for those who want to remain logged in to websites.
  • Clear Cookies Manually: Some browsers offer an option to clear all cookies upon closing. You can disable this setting to keep your cookies across sessions, although this compromises some privacy.
  • Third-Party Cookie Management: Use third-party cookie managers like Cookie Master or CCleaner to control which cookies are stored and for how long. This approach offers greater flexibility, but might not be a perfect solution for every website.
  • Enable "Keep Me Signed In": Many websites offer an option to "keep me signed in" or "remember me". This feature allows the website to store cookies specifically for your account, preserving your login state across browser sessions.

Navigating the Cookie Landscape

iOS 11's cookie management has sparked debate regarding user privacy and the balance between convenience and security. Ultimately, the best solution depends on your individual needs and preferences. It's important to weigh the benefits of enhanced privacy against the inconvenience of frequent logins and potential session loss.

By understanding the underlying mechanisms and exploring available workarounds, users can navigate this evolving cookie landscape and enjoy a more personalized and secure browsing experience on their iPhones.