Safari浏览器默认会阻止第三方cookie。
我有一个主站点A,在iframe中加载一个被框架的站点B。站点B需要设置一些cookie(当用户点击按钮时),以便正常运行。这些cookie被称为第三方cookie,因为它们不是由站点A设置的。
所以我找到了这个解决方案:https://github.com/vitr/safari-cookie-in-iframe
但在我的情况下,它不起作用,因为要设置cookie,用户首先必须单击一个按钮。
实际上,framed.html就像这样:
<!DOCTYPE html>
<html>
<head>
<title>Framed Page</title>
</head>
<body style="background-color: lightcoral;">
<h2>This is the framed site</h2>
<div border="0" class="cookie_button" id="continue_button" onclick="SetCookie('cookieAcceptanceCookie','accepted',9999);">accept</div>
</body>
</html>
有没有解决我的问题的方案?