Expires and max-age attributes of cookies

Source: Internet
Author: User

  • Expires attributes

    Coolie lifetime is specified. By default, coolie exists temporarily, and their stored values only exist during browser sessions. These values are also lost when users launch browsers, if you want the cookie to exist for a period of time, you must set the expires attribute to an expiration date in the future. Now it has been replaced by the Max-age attribute, and the max-age uses seconds to set the cookie survival time.

  • Path attribute

    It specifies the webpage associated with the cookie. By default, the cookie is associated with the webpage that is created, the webpage in the same directory, and the webpage in the subdirectory in the directory where the webpage is located.

  • Domain attributes

    The domain attribute allows multiple Web servers to share cookies. The default value of the domain attribute is the host name of the server on which the cookie is created. You cannot set the domain of a cookie to a domain other than the domain of the server.
    For example, the server located in order.example.com can read the cookie value set by catalog.example.com. If the cookie created on the catalog.example.com page sets its path attribute to "/" and the domain attribute to ".example.com", then all webpages in catalog.example.com and all webpages in orlders.example.com, and other servers in the example.com domain can access this coolie.

  • Secure attributes

    It is a Boolean value that specifies how cookies are transmitted over the network. By default, cookies are transmitted through a common HTTP connection.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.