Can a webpage in mobile Safari check whether Settings > Safari > Accept Cookies 'From visited' or 'Always' is selected?

人盡茶涼 提交于 2019-12-06 14:21:51

问题


Is there a JavaScript function or something that iOS provides so that I can check how strict the cookie setting is from a webpage?

If there isn't something that iOS provides, is there an industry standard process for detecting which setting is being used? My initial idea is to drop a cookie and check whether it's there...but I was wondering whether there is a better way.


回答1:


I highly suspect that there is no way to determine what the user's actual setting is, but Mobile Safari responds to navigator.cookieEnabled. The default for Mobile Safari (and even desktop Safari) is "From Visited". So if you are interested in 3rd party tracking via Cookies you may be out of luck, unless you find a way to bypass it (Google evidently did) or alert the user to change their setting to 'Always' (the fair/ethical route). I would say you are on to a reasonable and simple idea by setting a cookie from the 3rd party site and then checking if it is in fact there and then acting upon the result.

Lots of information in this SO post, Safari 3rd party cookie iframe trick no longer working?

And an interesting read from Gruber, http://daringfireball.net/2012/02/cookies_and_privacy



来源:https://stackoverflow.com/questions/14046997/can-a-webpage-in-mobile-safari-check-whether-settings-safari-accept-cookies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!