tags:

views:

161

answers:

2

Is there a difference between javascript cookies and php cookies?

A: 

No, cookies are defined by an RFC spec.

ryeguy
+10  A: 

HTTP Cookies are not a feature of PHP, nor a feature of Javascript : those are just programming languages that allow a developper to manipulate them.


The biggest difference between JS and PHP is that :

  • Javascript runs on the client side
  • PHP runs on the server side

But cookies are still the same : they are defined as a standard -- see RFC 2965.


Still, note that modern browsers implement cookies that are not accessible from Javascript (see the httponly option of setcookie) -- which means that, depending on the browser, and the way a cookie was set, it might not be accessible from Javascript.

This is a security measure -- and is not a difference between "js cookies" and "php cookies" : it's just a property of some cookies.

Pascal MARTIN