In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "how to understand domain name and cookie problem". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
Domain names and cookies
I came across a question: www.g.cn can set cookies to.g.cn, so can www.com.cn set cookies to.com.cn?
Test results: No. Because browsers know that www.com.cn has a suffix of.com.cn and not.cn, cookies cannot be set.
Because the browser has a built-in list of domain name suffixes. todo: If new suffixes appear later, and the old browser cannot update the list, won't it allow cookies to be set?
extension suffix first-level domain name second-level domain name www.g.cn.cng.cn*. g.cnwww.com.cn.com.cnwww.com.cn *. www.com.cnwww.google.com.cn.com.cngoogle.com.cn *.google.com.cn
Can www.example.com read cookies from. example.com?
Yes.
Can www.example.com read example.com cookies?
No. todo: Make www.example.com and example.com SSO to prevent cookies from being brought to static.example.com.
Can example.com read www.example.com cookies?
A: No.
setcookie ('a ', 'aa', time() + 1234, '/', ' example.com; Is the cookie set for.example.com or example.com?
A: Yes. example.com.
To set a cookie on example.com, you need to use setcookie ('default ', ' default', time() + 1234, '/');.
Cookie settings and reading range:
HTTP Request Domain Name First Level Domain Cookie settable (and readable) range Cookies unsettable Cookies unreadable example.comexample.com,. example.comwww.example.comexample.comwww.example.com,.www.example.com,. example.comg.com.cng.com.cnwww.com.cnwww.com.cn,. www.com.cn.com.cn
Set cookie code:
The copy code is as follows:
Read cookie code:
The copy code is as follows:
Screenshot of results:
"How to understand domain name and cookie problem" content introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 263
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.