* [CODE(JS)@en[document.domain]] 属性 (DOM HTML) ** 利用例 [1] [CITE[Abe Fettig’s Weblog » How to make XmlHttpRequest calls to another server in your domain]] * [CODE(HTTP)@en[domain]] 引数 (Cookie) [2] [CITE[document.cookie の覚え書き - Ci.nsIZIGOROu - Mozilla 拡張機能勉強会]] ([TIME[2009-02-01 18:27:09 +09:00]] 版) >現在 test.example.com で実行してるとして、 [PRE(JS example code)[ document.cookie = "Z=1"; alert(document.cookie); document.cookie = "Z=2;domain=example.com"; alert(document.cookie); document.cookie = "Z=3;domain=test.example.com"; alert(document.cookie); ]PRE] は IE6, 7 の場合、最終的に "Z=3;Z=2" となるのだが、Fx3, Safari だと、"Z=1;Z=2;Z=3" となる。 >domain が省略された場合、test.example.com 相当で設定したとされるべきだと思うんだけど。 > と思ったら、domain パラメータの挙動について見ている所が netscape の決めた奴と言う古い奴見てた事が判明。 >> :Domain=domain:Optional. The Domain attribute specifies the domain for which the cookie is valid. An explicitly specified domain must always start with a dot. >> RFC 2109 - 4.2.2 Set-Cookie Syntax >つまり、指定するなら "." から開始しないとだめぽって事。 >省略した場合の挙動は、 >> Domain Defaults to the request-host. (Note that there is no dot at the beginning of request-host.) >>RFC 2109 - 4.3.1 Interpreting Set-Cookie >"." を先頭につけないのが正しいと。 >[DEL[まぁこれらの結果分かるのは、domain 指定がある場合、別々の物として key-value のペアが管理されますよと考えられると。]] >[INS[この挙動、IEとそれ以外でだいぶ異なるみたいなので注意]]