Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible for two different web pages to use the same cookie? For example, some news sites now have buttons on the bottom, where if you are logged into facebook, you can just click the button to "like" the article. Is this a case of a 3rd party website using facebook's cookie to know which account you are, and if so, is there a way I can control it?

I'm not sure how the new "like" system works, so maybe the button part isn't actually on the news site, but hosted on facebooks servers or something, so it's really facebook itself accessing its own cookie. If that's the case, is there a way I can choose when a site accesses its own cookie?

Thanks for any help!

share|improve this question
up vote 0 down vote accepted

Each website is only able to access and manipulate its own cookie, but you can use frames and iframes to display a different website's widget on your site (and allow it to access its own cookie).

In the case of Facebook's button, you're referencing a PHP script and Javascript on Facebook's site, which are able to access the Facebook cookie.

For example:

<a name="fb_share" type="button" share_url="" href="">Share</a><script src="" type="text/javascript"></script>

If you want to restrict a site's ability to access its own cookie, you would have to either configure your browser settings as you usually would (some browsers can be configured to always prompt you whether or not to allow cookies for certain sites), configure something like NoScript to prevent the JavaScript from running unless you explicitly allow it, or set up a firewall rule that blocks traffic to the site in question.

share|improve this answer
Thanks, that makes a lot of sense! I already have NoScript, so we should be good to go – Brett Johnson May 21 '10 at 18:34

You must log in to answer this question.