How cookies are shared between different domain names

Source: Internet
Author: User
How cookies are shared between different domain names
Title

------Solution--------------------
Cookies for different domain names cannot be shared.
But you said if the first-level domain name is the same situation, it is possible. Set the cookie path to. Top-level domain
------Solution--------------------
discuss

Reference:

Cookies for different domain names cannot be shared.
But you said if the first-level domain name is the same situation, it is possible. Set the cookie path to. Top-level domain


I said is completely different, some sites have done, do not know how to do

------Solution--------------------
What is the scenario that some websites do, perhaps not the use of shared cookies?

discuss

Reference:

Cookies for different domain names cannot be shared.
But you said if the first-level domain name is the same situation, it is possible. Set the cookie path to. Top-level domain


I said is completely different, some sites have done, do not know how to do

------Solution--------------------
Suppose there is a domain name www.a.net, www.b.net
cookie.php files are available under each domain name
PHP Code
Header (' p3p:cp= ' CURa ADMa DEVa Psao psdo our BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR "'); if (isset ' token ']) {  setcookie (' name ', $_get[' token '). ' ' . $_server[' Http_host ');  echo "document.write ('
JS Cookie: ' +document.cookie+ '
');";} else {print_r ($_cookie); $url = $_server[' http_host '] = = ' www.a.net '? ' Www.b.net ': ' Www.a.net '; echo ""; echo "Test";}
  • 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.