Does the technique for setting third-party cookies

2020-03-01 08:48发布

I am trying to find a way to set cookies in an iframe in Safari. Safari has a policy of not allowing iframes to set cookies unless the user clicks on something in the iframe.

I have read through questions/answers on Stackoverflow and other articles. Here are some links:

They all mention variations of a technique to accomplish this. The basic idea is to create a form element and make it submit a POST request either through JavaScript calls or through the user clicking a button. Once a POST request is sent, Safari considers the user to have interacted with the site and thereafter allows cookies to be set.

I made a few attempts to implement this technique. I failed.

I found an article (http://online.wsj.com/article/SB10001424052970204880404577225380456599176.html) in the Wall Street Journal that talks about how Google used this technique to place their +1 buttons into their DoubleClick ads. The article also cites Anant Garg's blog post (link above) about how to work around the limitation.

Here's a quote from the article:

To get around Safari's default blocking, Google exploited a loophole in the browser's privacy settings. While Safari does block most tracking, it makes an exception for websites with which a person interacts in some way—for instance, by filling out a form. So Google added coding to some of its ads that made Safari think that a person was submitting an invisible form to Google. Safari would then let Google install a cookie on the phone or computer.

Another quote:

An Apple official said: "We are working to put a stop" to the circumvention of Safari privacy settings.

I am working with Safari 5.1.5 which was released on March 26, 2012. The WSJ article was published on February 17, 2012. Is it possible that Apple has changed Safari so that this workaround no longer works? Can anyone confirm that this technique works on Safari 5.1.5?

1条回答
放荡不羁爱自由
2楼-- · 2020-03-01 09:35

See this thread: Safari 3rd party cookie iframe trick no longer working?

Safari has enforced its cookie policy with 5.1.4.

查看更多
登录 后发表回答