3 <title>Testing cookies
</title>
5 <script type=
"text/javascript">
6 function setCookie(domain
, name
) {
7 document
.cookie
= name
+ "=ok;path=/;domain=" + domain
;
10 function showCookie() {
11 document
.getElementById("result").innerHTML
= "<p>" + document
.cookie
+ "</p>";
15 <body onload=
"showCookie();">
16 <h2>Cookie Mashing
</h2>
17 .com
<a href=
"#" onclick=
"setCookie('.com', 'the.com_one'); showCookie(); return false;">Click
</a></br />
18 .
<a href=
"#" onclick=
"setCookie('.', 'the.one'); showCookie(); return false;">Click
</a></br />
19 google.com
<a href=
"#" onclick=
"setCookie('google.com', 'google'); showCookie(); return false;">Click
</a></br />
20 .google.com
<a href=
"#" onclick=
"setCookie('.google.com', '.google'); showCookie(); return false;">Click
</a></br />
21 127.0.0.1 <a href=
"#" onclick=
"setCookie('127.0.0.1', 'localhost'); showCookie(); return false;">Click
</a></br />
22 localhost:
3001 <a href=
"#" onclick=
"setCookie('mency.ad.corp.google.com:62210', 'with_port'); showCookie(); return false;">Click
</a></br />
23 .google:
3001 <a href=
"#" onclick=
"setCookie('.google.com:62210', 'with_domain_and_port'); showCookie(); return false;">Click
</a></br />
24 172.16.12.225 <a href=
"#" onclick=
"setCookie('172.16.12.225', 'raw_IP'); showCookie(); return false;">Click
</a></br />
25 172.16.12.225:port
<a href=
"#" onclick=
"setCookie('172.16.12.225:62210', 'raw_IP_and_port'); showCookie(); return false;">Click
</a></br />
26 <a href=
"#" onclick=
"document.cookie = 'foo=bar;path=/common/galaxy';">Set on a different path
</a>
28 <div id=
"result"></div>