How can javascript read cookie cross-domain?

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

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

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.

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.


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 is not under my control, is it possible to read the cookie via the js in
I am invstigating possible solutions for that scenario.

Thanks again.
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.
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.