如下如图,我想在二级域名之间实现cookie的跨域,但是以下代码无法实现,请问下各位大佬,我哪里写错了啊??hosts:127.0.0.1 cross1.cross.com127.0.0.1 cross2.cross.comnginx:#...省略server{ listen 80; server_name cross1.cross.com; location / { root e:\/cross1; index index.html; } } server{ listen 80; server_name cross2.cross.com; location / { root e:\/cross2; index index.html; } }#...省略cross1/index.html<script> document.domain ='cross.com'; document.cookie="name=value";</script>cross2/index.html<script> document.domain ='cross.com'; console.log(document.cookie,'cross2');</script>这是cross1.html的cookie这是cross2.html的打印,可以看到没有任何显示,就是无法获取到cross1/index.html设置的cookie啊,这个是咋回事呀?
添加回答
举报
0/150
提交
取消