Javascript cookies vs php cookies

前端 未结 3 1811
梦如初夏
梦如初夏 2020-12-03 15:00

Is there a difference between javascript cookies and php cookies?

3条回答
  •  心在旅途
    2020-12-03 15:23

    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.

提交回复
热议问题