Home > Web Front-end > JS Tutorial > How to specify js to access cookies of other domain names_javascript skills

How to specify js to access cookies of other domain names_javascript skills

WBOY
Release: 2016-05-16 19:08:59
Original
2045 people have browsed it

Similar to paths, host names refer to different hosts in the same domain. For example, www.sosuo8.com and blog.sosuo8.com are two different host names. By default, cookies created in one host cannot be accessed in another host, but they can be controlled through the domain parameter. The syntax format is:
document.cookie="name=value; domain=cookieDomain";
Take sosuo8 as an example. To achieve cross-host access, it can be rewritten as:
document.cookie="name=value;domain=.sosuo8.com";
In this way, all Hosts under sosuo8.com can access this cookie.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template