Is it possible for jQuery to read browser cookies i.e. cookies set by facebook? This would be a great help for my application if it was possible.
Asked
Active
Viewed 1,073 times
1
-
this a [duplicate question](http://stackoverflow.com/questions/95213/can-jquery-read-write-cookies-to-a-browser)... the answer was: > See here: > http://plugins.jquery.com/project/cookie – Garis M Suero Jun 13 '10 at 18:03
-
@GarisSuero I know your comment is a bit dated now, but that is incorrect. jquery.cookie is a plugin that runs in the browser, and all modern browers will restrict access to cookies to only those created by the current website. As Miguel answered below, it's a security measure. – Mattygabe Apr 27 '12 at 15:27
2 Answers
3
Also, the answer is no. Your JavaScript won't be able to read cookies set by other websites. That's a security measure on browsers.
So at least for reading Facebook's cookies, there's no way to do it. Only to read cookies you've set for your own domain.

Miguel Ventura
- 10,344
- 2
- 31
- 41
2
Your website at http://www.not_facebook.com will not be able to read cookies set by Facebook, jQuery or no jQuery. The browser won't send them to you, and your Javascript can't see them.

Pointy
- 405,095
- 59
- 585
- 614