How can javascript read cookie cross-domain?

Dear experts,
I have following requirement:
1. I have www.mydomain.com website,
2. I have put javascript in the mydomain.com page;
3. When user access mydomain.com, the javascript is loaded to the user's browser;
4. the javascript should access some cookies which set by www.otherdomain.com

How can i implement that, or is there any workaround solution to do that?

Thanks!
matiascxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

COBOLdinosaurCommented:
You cannot do what you propose.  It would be a huge security risk and no browser is ever going to permit it.

If you control both domains, then you could put scripting on the target page to fetch the cookie and pass it server side but you would be begging to be hacked.

Cd&
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
matiascxAuthor Commented:
Hi, Cd,
Thanks for your response.
It is a little depressed for me to hear about that.
Can you give more explaination on your proposal?
I can not understand. If the both domain is under my control, how to implement that?
If the otherdomain.com is not under my control, is it possible to read the cookie via the js in mydomain.com?
I am invstigating possible solutions for that scenario.

Thanks again.
0
Dave BaldwinFixer of ProblemsCommented:
Because of security restrictions in modern browsers, you are not allowed to read the cookies belonging to someone else or some other domain.  Basically, cookies from another domain are none of your business and you have no rights to view them.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.