简体   繁体   English

Safari 3rd party cookie iframe 技巧不再有效?

[英]Safari 3rd party cookie iframe trick no longer working?

So this is the umteenth revenge of the "how do I get 3rd party cookies to work in Safari" question but I'm asking again because I think the playing field has changed, perhaps after February 2012. One of the standard tricks to get 3rd party cookies in Safari was as follows: use some javascript to POST to a hidden iframe.所以这是“我如何让 3rd 方 cookie 在 Safari 中工作”问题的第十次报复,但我再次问,因为我认为竞争环境已经改变,也许在 2012 年 2 月之后。获得 3rd 的标准技巧之一Safari 中的派对 cookie 如下:使用一些 javascript 发布到隐藏的 iframe。 It (used to) trick Safari into thinking that the user had interacted with the 3rd party content and so then allow cookies to be set.它(曾经)欺骗 Safari 认为用户已经与第 3 方内容进行了交互,然后允许设置 cookie。

I think this loophole has been closed in the wake of the mild scandal where it was revealed that Google was using that trick with its ads.认为这个漏洞已经在轻微的丑闻之后被关闭了,因为它被揭露谷歌在其广告中使用了这个技巧。 At the very least, while using this trick I have been completely unable to set cookies in Safari.至少,在使用这个技巧时,我完全无法在 Safari 中设置 cookie。 I unearthed some random internet postings that claimed that Apple was working on closing the loophole but I haven't found any official word.我发现了一些随机的互联网帖子,声称 Apple 正在努力弥补漏洞,但我没有找到任何官方消息。

As a fallback I even tried redesigning the main third party frame so that you had to click on a button before the content would load but even that level of direct interaction was not enough to melt Safari's cold cold heart.作为后备,我什至尝试重新设计主要的第三方框架,以便您必须在加载内容之前单击一个按钮,但即使是这种级别的直接交互也不足以融化 Safari 冰冷的心。

So does anyone know for certain if Safari has indeed closed this loophole?那么有没有人确定Safari是否确实关闭了这个漏洞? If so, are there other workarounds (other than manually including a session ID in every request)?如果是这样,是否有其他解决方法(除了在每个请求中手动包含会话 ID)?

Just wanted to leave a simple working solution here that does not require user interaction .只是想在这里留下一个不需要用户交互的简单工作解决方案。

As I stated in a post I made :正如我在一篇文章中所述:

Basically all you need to do is load your page on top.location, create the session and redirect it back to facebook.基本上您需要做的就是在 top.location 上加载您的页面,创建会话并将其重定向回 Facebook。

Add this code in the top of your index.php and set $page_url to your application final tab/app URL and you'll see your application will work without any problem.将此代码添加到index.php的顶部并将$page_url设置$page_url您的应用程序最终选项卡/应用程序 URL,您将看到您的应用程序将正常运行。

<?php
    // START SAFARI SESSION FIX
    session_start();
    $page_url = "http://www.facebook.com/pages/.../...?sk=app_...";
    if (isset($_GET["start_session"]))
        die(header("Location:" . $page_url));

    if (!isset($_GET["sid"]))
        die(header("Location:?sid=" . session_id()));
    $sid = session_id();
    if (empty($sid) || $_GET["sid"] != $sid):
?>
   <script>
        top.window.location="?start_session=true";
    </script>
<?php
    endif;
    // END SAFARI SESSION FIX
?>

Note: This was made for facebook, but it would actually work within any other similar situations.注意:这是为 facebook 制作的,但它实际上可以在任何其他类似情况下工作。


Edit 20-Dec-2012 - Maintaining Signed Request: 2012 年 12 月 20 日编辑 - 维护签名请求:

The above code does not maintain the requests post data, and you would loose the signed_request, if your application relies on signed request feel free to try the following code:上面的代码不维护请求发布数据,并且您将丢失签名请求,如果您的应用程序依赖签名请求,请随意尝试以下代码:

Note: This is still being tested properly and may be less stable than the first version.注意:这仍在正确测试中,可能不如第一个版本稳定。 Use at your own risk / Feedback is appreciated.使用风险自负/感谢反馈。

(Thanks to CBroe for pointing me into the right direction here allowing to improve the solution) (感谢CBroe在这里为我指明了正确的方向,以改进解决方案)

// Start Session Fix
session_start();
$page_url = "http://www.facebook.com/pages/.../...?sk=app_...";
if (isset($_GET["start_session"]))
    die(header("Location:" . $page_url));
$sid = session_id();
if (!isset($_GET["sid"]))
{
    if(isset($_POST["signed_request"]))
       $_SESSION["signed_request"] = $_POST["signed_request"];
    die(header("Location:?sid=" . $sid));
}
if (empty($sid) || $_GET["sid"] != $sid)
    die('<script>top.window.location="?start_session=true";</script>');
// End Session Fix

You said you were willing to have your users click a button before the content loads.你说你愿意让你的用户在内容加载之前点击一个按钮。 My solution was to have a button open a new browser window.我的解决方案是让一个按钮打开一个新的浏览器窗口。 That window sets a cookie for my domain, refreshes the opener and then closes.该窗口为我的域设置了一个 cookie,刷新了打开程序,然后关闭。

So your main script could look like:所以你的主脚本可能看起来像:

<?php if(count($_COOKIE) > 0): ?>
<!--Main Content Stuff-->
<?php else: ?>
<a href="/safari_cookie_fix.php" target="_blank">Click here to load content</a>
<?php endif ?>

Then safari_cookie_fix.php looks like:然后 safari_cookie_fix.php 看起来像:

<?php
setcookie("safari_test", "1");
?>
<html>
    <head>
        <title>Safari Fix</title>
        <script type="text/javascript" src="/libraries/prototype.min.js"></script>
    </head>
    <body>
    <script type="text/javascript">
    document.observe('dom:loaded', function(){
        window.opener.location.reload();
        window.close();
    })
    </script>
    This window should close automatically
    </body>
</html>

I tricked Safari with a .htaccess:我用 .htaccess 欺骗了 Safari:

#http://www.w3.org/P3P/validator.html
<IfModule mod_headers.c>
Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"NOI DSP COR NID CUR ADM DEV OUR BUS\""
Header set Set-Cookie "test_cookie=1"
</IfModule>

And it stopped working for me too.它也停止为我工作。 All my apps are losing the session in Safari and are redirecting out of Facebook.我所有的应用程序都在 Safari 中丢失了会话,并且正在重定向出 Facebook。 As I'm in a hurry to fix those apps, I'm currently searching for a solution.由于我急于修复这些应用程序,我目前正在寻找解决方案。 I'll keep you posted.我会及时向大家发布。

Edit (2012-04-06): Apparently Apple "fixed" it with 5.1.4.编辑(2012-04-06):显然苹果用 5.1.4“修复”了它。 I'm sure this is the reaction to the Google-thing: "An issue existed in the enforcement of its cookie policy. Third-party websites could set cookies if the "Block Cookies" preference in Safari was set to the default setting of "From third parties and advertisers". http://support.apple.com/kb/HT5190我确定这是对 Google 事物的反应:“执行其 cookie 策略时存在问题。如果 Safari 中的“阻止 Cookie”首选项设置为默认设置,第三方网站可以设置 cookie来自第三方和广告商” 。http://support.apple.com/kb/HT5190

For my specific situation I resolved the problem by using window.postMessage() and eliminating any user interaction.对于我的具体情况,我通过使用 window.postMessage() 并消除任何用户交互来解决该问题。 Note that this will only work if you can somehow execute js in the parent window.请注意,这仅在您可以以某种方式在父窗口中执行 js 时才有效。 Either by having it include a js from your domain, or if you have direct access to the source.通过让它包含来自您的域的 js,或者如果您可以直接访问源代码。

In the iframe (domain-b) i check for the presence of a cookie and if it is not set will send a postMessage to the parent (domain-a).在 iframe (domain-b) 中,我检查是否存在 cookie,如果未设置,则会向父级 (domain-a) 发送 postMessage。 Eg;例如;

if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1
    && document.cookie.indexOf("safari_cookie_fix") < 0) {
    window.parent.postMessage(JSON.stringify({ event: "safariCookieFix", data: {} }));
}

Then in the parent window (domain-a) listen for the event.然后在父窗口(域-a)中监听事件。

if (typeof window.addEventListener !== "undefined") {
    window.addEventListener("message", messageReceived, false);
}

function messageReceived (e) {
    var data;

    if (e.origin !== "http://www.domain-b.com") {
        return;
    }

    try {
        data = JSON.parse(e.data);
    }
    catch (err) {
        return;
    }

    if (typeof data !== "object" || typeof data.event !== "string" || typeof data.data === "undefined") {
        return;
    }

    if (data.event === "safariCookieFix") {
        window.location.href = e.origin + "/safari/cookiefix"; // Or whatever your url is
        return;
    }
}

Finally on your server (http://www.domain-b.com/safari/cookiefix) you set the cookie and redirect back to where the user came from.最后在您的服务器 (http://www.domain-b.com/safari/cookiefix) 上设置 cookie 并重定向回用户来自的位置。 Below example is using ASP.NET MVC下面的例子是使用 ASP.NET MVC

public class SafariController : Controller
{
    [HttpGet]
    public ActionResult CookieFix()
    {
        Response.Cookies.Add(new HttpCookie("safari_cookie_fix", "1"));

        return Redirect(Request.UrlReferrer != null ? Request.UrlReferrer.OriginalString : "http://www.domain-a.com/");
    }

}

In your Ruby on Rails controller you can use:在您的 Ruby on Rails 控制器中,您可以使用:

private

before_filter :safari_cookie_fix

def safari_cookie_fix
  user_agent = UserAgent.parse(request.user_agent) # Uses useragent gem!
  if user_agent.browser == 'Safari' # we apply the fix..
    return if session[:safari_cookie_fixed] # it is already fixed.. continue
    if params[:safari_cookie_fix].present? # we should be top window and able to set cookies.. so fix the issue :)
      session[:safari_cookie_fixed] = true
      redirect_to params[:return_to]
    else
      # Redirect the top frame to your server..
      render :text => "<script>alert('start redirect');top.window.location='?safari_cookie_fix=true&return_to=#{set_your_return_url}';</script>"
    end
  end
end

I had the same problem and today I found a fix that works fine for me.我遇到了同样的问题,今天我找到了一个适合我的修复程序。 If the user agent contains Safari and no cookies are set, I redirect the user to the OAuth Dialog:如果用户代理包含Safari并且没有设置 cookie,我会将用户重定向到 OAuth 对话框:

<?php if ( ! count($_COOKIE) > 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Safari')) { ?>
<script type="text/javascript">
    window.top.location.href = 'https://www.facebook.com/dialog/oauth/?client_id=APP_ID&redirect_uri=MY_TAB_URL&scope=SCOPE';
</script>
<?php } ?>

After authentication and asking for permissions the OAuth Dialog will redirect to my URI in the top location.在身份验证和请求权限后,OAuth 对话框将重定向到顶部位置的我的 URI。 So setting cookies is possible.所以设置cookies是可能的。 For all of our canvas and page tab apps I have already included the following script:对于我们所有的画布和页面选项卡应用程序,我已经包含了以下脚本:

<script type="text/javascript">
    if (top.location.href==location.href) top.location.href = 'MY_TAB_URL';
</script>

So the user will be redirected again to the Facebook page tab with a valid cookie already set and the signed request is posted again.因此,用户将再次重定向到已设置有效 cookie的 Facebook 页面选项卡,并再次发布签名请求。

I finally went for a similar solution to the one that Sascha provided, however with some little adjusting, since I'm setting the cookies explicitly in PHP:我终于找到了与 Sascha 提供的解决方案类似的解决方案,但稍作调整,因为我在 PHP 中明确设置了 cookie:

// excecute this code if user has not authorized the application yet
// $facebook object must have been created before

$accessToken = $_COOKIE['access_token']

if ( empty($accessToken) && strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') ) {

    $accessToken = $facebook->getAccessToken();
    $redirectUri = 'https://URL_WHERE_APP_IS_LOCATED?access_token=' . $accessToken;

} else {

    $redirectUri = 'https://apps.facebook.com/APP_NAMESPACE/';

}

// generate link to auth dialog
$linkToOauthDialog = $facebook->getLoginUrl(
    array(
        'scope'         =>  SCOPE_PARAMS,
        'redirect_uri'  =>  $redirectUri
    )
);

echo '<script>window.top.location.href="' . $linkToOauthDialog . '";</script>';

What this does is check if the cookie is available when the browser is safari.这样做是在浏览器是 safari 时检查 cookie 是否可用。 In the next step, we are on the application domain, namely the URI provided as URL_WHERE_APP_IS_LOCATED above.在下一步中,我们在应用程序域上,即上面作为 URL_WHERE_APP_IS_LOCATED 提供的 URI。

if (isset($_GET['accessToken'])) {

    // cookie has a lifetime of only 10 seconds, so that after
    // authorization it will disappear
    setcookie("access_token", $_GET['accessToken'], 10); 

} else {

  // depending on your application specific requirements
  // redirect, call or execute authorization code again
  // with the cookie now set, this should return FB Graph results

}

So after being redirecting to the application domain, a cookie is set explicitly, and I redirect the user to the authorization process.因此,在重定向到应用程序域后,显式设置了 cookie,并将用户重定向到授权过程。

In my case (since I'm using CakePHP but it should work fine with any other MVC framework) I'm calling the login action again where the FB authorization is executed another time, and this time it succeeds due to the existing cookie.在我的情况下(因为我使用的是 CakePHP,但它应该可以与任何其他 MVC 框架一起正常工作)我再次调用登录操作,其中再次执行 FB 授权,这次由于现有 cookie 成功。

After having authorized the app once, I didn't have any more problems using the app with Safari (5.1.6)对应用程序进行一次授权后,我在 Safari (5.1.6) 上使用该应用程序没有任何问题

Hope that might help anyone.希望这可以帮助任何人。

I had this problem on devices running iOS.我在运行 iOS 的设备上遇到了这个问题。 I made a shop that is embeddable in a normal website using an iframe.我使用 iframe 制作了一个可嵌入普通网站的商店。 Somehow, on every pageload the user got a new sessionid, resulting in users getting stuck halfway the process because some values weren't present in the session.不知何故,在每次页面加载时,用户都会获得一个新的 sessionid,导致用户在进程中途卡住,因为会话中不存在某些值。

I tried some of the solutions given on this page, but popups don't work very well on an iPad and I needed the most transparent solution.我尝试了此页面上给出的一些解决方案,但弹出窗口在 iPad 上效果不佳,我需要最透明的解决方案。

I resolved it using a redirect.我使用重定向解决了它。 The website that embeds my site must first redirect the user to my site, so the top frame contains the url to my site, where I set a cookie and redirect the user to the proper page on the website that embeds my site, that is passed through in the url.嵌入我的网站的网站必须首先将用户重定向到我的网站,因此顶部框架包含我网站的 url,我在其中设置了一个 cookie 并将用户重定向到嵌入我的网站的网站上的正确页面,该页面被传递通过网址。

Example PHP code示例 PHP 代码

Remote website redirects user to远程网站将用户重定向到

http://clientname.example.com/init.php?redir=http://www.domain.com/shop/frame

init.php初始化文件

<?php
// set a cookie for a year
setcookie('initialized','1',time() + 3600 * 24 * 365, '/', '.domain.com', false, false);
header('location: ' . $_GET['redir']);
die;

The user ends up on http://www.domain.com/shop/frame where my site is embedded, storing sessions as it should and eating cookies.用户最终会http://www.domain.com/shop/frame我的网站嵌入的http://www.domain.com/shop/frame ,按原样存储会话并食用 cookie。

Hope this helps someone.希望这可以帮助某人。

Let me share my fix in ASP.NET MVC 4. The main idea like in correct answer for PHP.让我分享我在 ASP.NET MVC 4 中的修复。主要思想就像 PHP 的正确答案。 The next code added in main Layout in header near scripts section:在脚本部分附近的标题中的主布局中添加的下一个代码:

@if (Request.Browser.Browser=="Safari")
{
    string pageUrl = Request.Url.GetLeftPart(UriPartial.Path);
    if (Request.Params["safarifix"] != null && Request.Params["safarifix"] == "doSafariFix")
    {
        Session["IsActiveSession"] = true;
        Response.Redirect(pageUrl);
        Response.End();
    }
        else if(Session["IsActiveSession"]==null)
    {
        <script>top.window.location = "?safarifix=doSafariFix";</script>
    }
}

This solution applies in some cases - if possible:此解决方案适用于某些情况 - 如果可能:

If the iframe content page uses a subdomain of the page containing the iframe, the cookie is no longer blocked.如果 iframe 内容页面使用包含 iframe 的页面的子域,则不再阻止 cookie。

Google actually let the cat out of the bag on this one.谷歌实际上在这个问题上放过了猫。 They were using it for a while to access tracking cookies.他们使用它来访问跟踪 cookie 有一段时间了。 It was fixed almost immediately by Apple =\\ Apple 几乎立即修复了它 =\\

original Wall Street Journal post华尔街日报帖子

Here's some code that I use.这是我使用的一些代码。 I found that if I set any cookie from my site, then cookies magically work in the iframe from then on.我发现,如果我从我的网站设置任何 cookie,那么 cookie 从那时起就会在 iframe 中神奇地工作。

http://developsocialapps.com/foundations-of-a-facebook-app-framework/ http://developsocialapps.com/foundations-of-a-facebook-app-framework/

 if (isset($_GET['setdefaultcookie'])) {
        // top level page, set default cookie then redirect back to canvas page
        setcookie ('default',"1",0,"/");
        $url = substr($_SERVER['REQUEST_URI'],strrpos($_SERVER['REQUEST_URI'],"/")+1);
        $url = str_replace("setdefaultcookie","defaultcookieset",$url);
        $url = $facebookapp->getCanvasUrl($url);
        echo "<html>\n<body>\n<script>\ntop.location.href='".$url."';\n</script></body></html>";
        exit();
    } else if ((!isset($_COOKIE['default'])) && (!isset($_GET['defaultcookieset']))) {
        // no default cookie, so we need to redirect to top level and set
        $url = $_SERVER['REQUEST_URI'];
        if (strpos($url,"?") === false) $url .= "?";
        else $url .= "&";
        $url .= "setdefaultcookie=1";
        echo "<html>\n<body>\n<script>\ntop.location.href='".$url."';\n</script></body></html>";
        exit();
    }

A slightly simper version in PHP of what others have posted:一个稍微简单的 PHP 版本,与其他人发布的内容相比:

if (!isset($_COOKIE, $_COOKIE['PHPSESSID'])) {
    print '<script>top.window.location="https://example.com/?start_session=true";</script>';
    exit();
}

if (isset($_GET['start_session'])) {
    header("Location: https://apps.facebook.com/YOUR_APP_ID/");
    exit();
}

I have found the perfect answer to this, all thanks to a guy called Allan that deserves all of the credit here.我找到了完美的答案,这一切都归功于一个叫艾伦的人,他在这里值得所有的荣誉。 ( http://www.allannienhuis.com/archives/2013/11/03/blocked-3rd-party-session-cookies-in-iframes/ ) ( http://www.allannienhuis.com/archives/2013/11/03/blocked-3rd-party-session-cookies-in-iframes/ )

His solution is simple and easy to understand.他的解决方案简单易懂。

On iframe content server (domain 2), add a file called startsession.php at the root domain level that contains:在 iframe 内容服务器(域 2)上,在根域级别添加一个名为startsession.php的文件,其中包含:

<?php
// startsession.php
session_start();
$_SESSION['ensure_session'] = true;
die(header('location: '.$_GET['return']));

Now on the top level website containing the iframe (domain1), the call to the page containing the iframe should look like:现在在包含 iframe (domain1) 的顶级网站上,对包含 iframe 的页面的调用应如下所示:

<a href="https://domain2/startsession.php?return=http://domain1/pageWithiFrame.html">page with iFrame</a>

And that's it!就是这样! Simples :)简单:)

The reason this works is because you are directing the browser to a third party URL and thus telling it to trust it before showing content from it within the iframe.这样做的原因是因为您将浏览器定向到第三方 URL,因此在 iframe 中显示来自它的内容之前告诉它信任它。

I used modified (added signed_request param to the link) Whiteagle's trick and it worked ok for safari, but IE is constantly refreshing the page in that case.我使用了修改过的(在链接中添加了 signed_request 参数)Whiteagle 的技巧,它在 safari 中运行良好,但在这种情况下,IE 会不断刷新页面。 So my solution for safari and internet explorer is:所以我对 safari 和 Internet Explorer 的解决方案是:

$fbapplink = 'https://apps.facebook.com/[appnamespace]/';
$isms = stripos($_SERVER['HTTP_USER_AGENT'], 'msie') !== false;

// safari fix
if(! $isms  && !isset($_SESSION['signed_request'])) {

    if (isset($_GET["start_session"])) {
        $_SESSION['signed_request'] = $_GET['signed_request'];
        die(header("Location:" . $fbapplink ));

    }
    if (!isset($_GET["sid"])) {
        die(header("Location:?sid=" . session_id() . '&signed_request='.$_REQUEST['signed_request']));
    }
    $sid = session_id();
    if (empty($sid) || $_GET["sid"] != $sid) {
    ?>
    <script>
        top.window.location="?start_session=true";
    </script>
    <?php
    exit;
    }
}

// IE fix
header('P3P: CP="CAO PSA OUR"');
header('P3P: CP="HONK"');


.. later in the code

$sr = $_REQUEST['signed_request'];
if($sr) {
        $_SESSION['signed_request'] = $sr;
} else {
        $sr = $_SESSION['signed_request'];
}

我也一直遇到这个问题,但最终得到了解决方案,最初直接在浏览器中加载 iframe url 就像小弹出窗口一样,然后只访问 iframe 内的会话值。

Safari now blocks all third party cookies. Safari 现在会阻止所有第三方 cookie。 You can only use the Storage API to try to get user access to their third party cookies.您只能使用 Storage API 来尝试让用户访问其第三方 cookie。

https://www.infoq.com/news/2020/04/safari-third-party-cookies-block/ https://www.infoq.com/news/2020/04/safari-third-party-cookies-block/

Some context that I haven't seen clearly stated in the existing answers (and also a lot has changed since 2012!):我在现有答案中没有清楚说明的一些上下文(自 2012 年以来也发生了很多变化!):

If you can control both the 3rd party iframe and the parent page (ie you are able to insert JavaScript on the parent page), then several workarounds are available.如果您可以同时控制第 3 方 iframe 和父页面(即您可以在父页面上插入 JavaScript),那么有几种解决方法可用。 I would suggest the most elegant of these is making use of the postMessage API as described by @Frank's answer, as a) this does not require any redirects and b) does not require any user interactions.我建议其中最优雅的方法是使用 @Frank 的回答所描述的 postMessage API,因为 a) 这不需要任何重定向,b) 不需要任何用户交互。

If you do NOT control both the 3rd party iframe and the parent page , eg you have a widget hosted on a site you do not control, then most of the answers posted here will not work in Safari as of May 2020 , and will stop working in Chrome around 2022 .如果您不控制第 3 方 iframe 和父页面,例如您在不受控制的网站上托管了一个小部件,那么截至 2020 年 5 月,此处发布的大多数答案在Safari中将不起作用,并且将停止工作2022 年左右在 Chrome 中 That is, unless a user has already visited your domain or interacts with the iframe, you are not able to set cookies.也就是说,除非用户已经访问了您的域或与 iframe 交互,否则您无法设置 cookie。 However, there are some commercial services offering solutions to solve this problem, such as CloudCookie.io但是,有一些商业服务提供了解决此问题的解决方案,例如CloudCookie.io

I recently hit the same issue on Safari.我最近在 Safari 上遇到了同样的问题。 The solution I figured out is based on the Local Storage HTML5 API.我想出的解决方案是基于本地存储 HTML5 API。 Using Local Storage you could emulate cookies.使用本地存储,您可以模拟 cookie。

Here's my blog post with details: http://log.scalemotion.com/2012/10/how-to-trick-safari-and-set-3rd-party.html这是我的详细博客文章: http : //log.scalemotion.com/2012/10/how-to-trick-safari-and-set-3rd-party.html

I decided to get rid of the $_SESSION variable all together & wrote a wrapper around memcache to mimic the session.我决定一起摆脱$_SESSION变量并在 memcache 周围编写一个包装器来模拟会话。

Check https://github.com/manpreetssethi/utils/blob/master/Session_manager.php检查https://github.com/manpreetssethi/utils/blob/master/Session_manager.php

Use-case: The moment a user lands on the app, store the signed request using the Session_manager and since it's in the cache, you may access it on any page henceforth.用例:在用户登陆应用程序的那一刻,使用 Session_manager 存储已签名的请求,因为它在缓存中,您以后可以在任何页面上访问它。

Note: This will not work when browsing privately in Safari since the session_id resets every time the page reloads.注意:这在 Safari 中进行私密浏览时不起作用,因为每次页面重新加载时 session_id 都会重置。 (Stupid Safari) (愚蠢的野生动物园)

You can resolve this issue by adding header as p3p policy..i had same issue on safari so after adding header on top of the files has resolved my problem.您可以通过将标头添加为 p3p 策略来解决此问题。我在 safari 上遇到了同样的问题,因此在文件顶部添加标头后解决了我的问题。

<?php
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM