Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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="http://example.com" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.