From dfd93732c8f1e18fdd6a80904a1a6a11906eb048 Mon Sep 17 00:00:00 2001 From: Marko Bencun Date: Sun, 13 Jul 2025 17:25:24 +0200 Subject: [PATCH] add section about Storage Access API required for third-party cookies by WebKit/Safari See https://webkit.org/blog/10218/full-third-party-cookie-blocking-and-more/. This allows testing if cookies work with and without using the Storage Access API. --- public/index.php | 9 +++++++++ public/js/main.js | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/public/index.php b/public/index.php index 74921d7..3d581b1 100644 --- a/public/index.php +++ b/public/index.php @@ -148,6 +148,15 @@ function displayUrl($url, $main) { See also some known browser quirks.

+

+ Implicit Third-party cookies are fully blocked + by WebKit as of iOS 13.4 and Safari 13.1, so this site is not expected to be able to set cookies if embeded in an iframe in a third-party. + The linked article explains that calling `document.requestStorageAccess();` is necessary to request permission to use cookies in this context. +

+ +
+

+
{ + resultDiv.innerHTML = 'Cookie access granted'; + }, + () => { + resultDiv.innerHTML = 'Cookie access denied'; + }, + ); +} + +window.addEventListener('load', function() { + let resultDiv = document.querySelector('#hasStorageAccessResult'); + document.hasStorageAccess().then( + (hasAccess) => { + resultDiv.innerHTML = "hasStorageAccess result: " + hasAccess.toString(); + }, + function (reason) { + resultDiv.innerHTML = "hasStorageAccess failed with: " + reason.toString(); + } + ); +});