Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I set cookie in From this URL :
http://localhost:8585/demos/project/index.html

and I can acces to my cookie From this address : http://localhost:8585/demos/Project/HtmlPage.html

But whay I cant acces to my cookie from this addres? :
file:///C:/demos/Project/HtmlPage.html

all of my code is javaScript and no serverside code ! !
How I can access to cookie From another webpages ?
Posted
Comments
Bernhard Hiller 17-Nov-14 3:09am    
I hope my browser has enough in-built safety measures to prevent such cookie-stealing attacks!

1 solution

Cookies are domain specific, means the browser will send the cookie only if your request domain is the same (or a sub-domain of) as the cookie's domain.
In your case the file://C:/ root is not even the same protocol as in http://localhost. And in any case file:// protocol does not support cookies...
 
Share this answer
 
Comments
‫محم د‬‎ 16-Nov-14 5:41am    
Ok
and no way to read from another domain ?
for example localhost:80 and localhost:8585 can not accet to them ?
Kornfeld Eliyahu Peter 16-Nov-14 5:45am    
According to this - http://tools.ietf.org/html/rfc6265 - port is not part of the domain name in concern with cookies...
I can't tell you how browsers are follow that...Never tested...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900