阻止第三方Cookie - 解决方法(Facebook应用程序等) [英] block third party cookies - workaround (facebook apps etc)

查看:957
本文介绍了阻止第三方Cookie - 解决方法(Facebook应用程序等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mac上的Safari有一个块饼干设置为来自第三方和广告商默认

它停止共享对象,如果从嵌入的SWF是从不同的领域工作。

这个问题是不是新的: <一href="http://stackoverflow.com/questions/9930671/safari-3rd-party-cookie-iframe-trick-no-longer-working">Safari第三方cookie的iframe中招不再工作?

有没有人找到了一个解决方案(其他然后传递会话ID通过GET / POST PARAMS中的每一个请求)?

请注意: 我的网站,这是嵌入的swf进不去,所以没有办法改变HTML或把任何JavaScript等。

解决方案

 函数setCookie方法(){
   如果(navigator.userAgent.indexOf(野生动物园)= -1放大器;!&安培;
        navigator.userAgent.indexOf('铬')== -1){
      的window.open('safari.php','','宽度= 200,高度= 100');
   }
}

//那么我们设置safari.php饼干
 

来源:<一href="http://www.reizbombardement.de/archives/safari-5-1-4-enforces-cookie-policy">http://www.reizbombardement.de/archives/safari-5-1-4-enforces-cookie-policy

//更新2013年7月23日

解决这个问题,过去常常工作到6的Safari这种蹩脚的方式。

请参阅@Fabio安栋梁及以下@ncubica意见。

//更新2013年7月23日由法比奥·安图内斯

下面是我的code

在登陆页面,我们将有关于应用程序和一个按钮说像输入的简要说明。我使用jQuery来简化这个过程中,创造了一个侦听click事件,我只是把JavaScript的code,因为我假设你已经拥有的HTML code,其余为登陆页面:

  $(文件)。在(点击,#BT-登陆,函数(){
变种左=(screen.width / 2) - (二分之五百);
            变种顶=(screen.height / 2) - (二分之二百五十零);
            的window.open('URL_FOR_THE_PHP_THAT_WILL_CREATE_THE_SESSION,_blank,宽度= 500,高度= 250,工具栏= 0,位置= 0,菜单栏= 0,最高='+顶部+',左='+左);
});
 

此,您将通过250像素,集中在屏幕上打开一个小窗口,以500。

在code我有一个小窗口是这样的:

 &LT; PHP的setcookie(safari_cookie,1);?&GT;
    &LT; HTML&GT;
        &LT; HEAD&GT;
            &LT;元字符集=utf-8&GT;
            &LT;标题&gt;将你的应用程序或者一些用户我们将阅读并假设这个小窗口是可靠和LT的名称; /标题&GT;
        &LT; /头&GT;
        &LT;身体GT;
        &LT;脚本类型=文/ JavaScript的&GT;
        $(文件)。就绪(函数(){
           的setTimeout(函数(){window.close()的},1000);
        })
        &LT; / SCRIPT&GT;
        &LT; /身体GT;
    &LT; / HTML
 

Safari on a Mac has a Block cookies set to From third parties and advertisers by default.

It stops the SharedObject from working if the embedded swf is from a different domain.

This problem isn't new: Safari 3rd party cookie iframe trick no longer working?

Has anyone found a solution (other then passing the Session ID through GET/POST params in each request)?

NOTE: I have no access to the site, which is embedding the swf, so there is no way to alter that HTML or to put any JavaScript, etc.

解决方案

function setCookie(){
   if ( navigator.userAgent.indexOf('Safari') != -1 &&
        navigator.userAgent.indexOf('Chrome') == -1 ){
      window.open('safari.php','','width=200,height=100' );
   }
}

// then we set the cookie in safari.php

Source: http://www.reizbombardement.de/archives/safari-5-1-4-enforces-cookie-policy

//UPDATE 23 July 2013

This crappy way of fixing this issue used to work until Safari 6.

Please see @Fabio Antunes and @ncubica comments below.

//UPDATE 23 July 2013 by Fabio Antunes

Here's my code

On the landing page we'll have a brief description about the app and a button saying something like "enter". I'm using jquery to simplify this process, creating a listener for the click event, I'll just put the javascript code, since I'm assuming you already have the rest of the html code for the landing page:

$(document).on("click", "#bt-landing", function(){
var left = (screen.width/2)-(500/2);
            var top = (screen.height/2)-(250/2);
            window.open('URL_FOR_THE_PHP_THAT_WILL_CREATE_THE_SESSION', '_blank', 'width=500,height=250,toolbar=0,location=0,menubar=0, top='+top+', left='+left);
});

This you'll open a small window, with 500 by 250 px, centered on your screen.

The code I have for the small window is this:

<?php setcookie("safari_cookie", "1");?>
    <html>
        <head>
            <meta charset="utf-8">
            <title>THE NAME OF YOUR APP OR SOMETHING THAT THE USER WE'LL READ AND ASSUME THAT THIS SMALL WINDOW IS RELIABLE</title>
        </head>
        <body>
        <script type="text/javascript">
        $(document).ready(function(){
           setTimeout(function(){window.close()},1000);
        })
        </script>
        </body>
    </html

这篇关于阻止第三方Cookie - 解决方法(Facebook应用程序等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆