By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,567 Members | 1,554 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,567 IT Pros & Developers. It's quick & easy.

Cookies

P: n/a
Is it possible for me to set a cookie from MyDomain1.com and then read that
same cookie from MyDomain2.com?
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a


Simon B. Nielsen wrote:
Is it possible for me to set a cookie from MyDomain1.com and then read that
same cookie from MyDomain2.com?


No, you can set a cookie from host1.domain.tld with
document.cookie = 'cokieName=' + escape(cookieValue) +
'; domain=domain.tld'
and then read it from host2.domain.tld
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

P: n/a
rf

"Simon B. Nielsen" <si***@webplanet.dk> wrote in message
news:uB**********************@news010.worldonline. dk...
Is it possible for me to set a cookie from MyDomain1.com and then read that same cookie from MyDomain2.com?


Not unless you change the security settings in your browser. You can't do it
on my system.

Cheers
Richard.
Jul 20 '05 #3

P: n/a

"Simon B. Nielsen" <si***@webplanet.dk> wrote in message
news:uB**********************@news010.worldonline. dk...
Is it possible for me to set a cookie from MyDomain1.com and then read that same cookie from MyDomain2.com?

From MyDomain1.com, set a cookie for MyDomain2.com - I believe you can
write, but not read to someone else's domain name... thus by having a script
executed from MyDomain1.com and planting it at MyDomain2.com - you should
then be able to use code on MyDomain2.com to read MyDomain2.com cookies...

I'm not certain of this, but believe the 'rule' to be that you have no read
access to another domains cookies - I don't believe there is a problem to
createing a cookie for a domain any domain.
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.