Connecting Tech Pros Worldwide Help | Site Map

Reading Cookie from a different domain?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 10:01 AM
kam bansal
Guest
 
Posts: n/a
Default Reading Cookie from a different domain?

Hi all,

Can javascript read a cookie from a different domain? Meaning, if my
html page is running on "www.mydomain.com" and I goto another domain
"www.another.com" to do some work, and then I come back, can I see the
cookie that "www.another.com" created from my domain???

Any thoughts?

~Kam (^8*

  #2  
Old July 20th, 2005, 10:01 AM
Laurent Bugnion, GalaSoft
Guest
 
Posts: n/a
Default Re: Reading Cookie from a different domain?

Hi,

kam bansal wrote:[color=blue]
> Hi all,
>
> Can javascript read a cookie from a different domain? Meaning, if my
> html page is running on "www.mydomain.com" and I goto another domain
> "www.another.com" to do some work, and then I come back, can I see the
> cookie that "www.another.com" created from my domain???
>
> Any thoughts?
>
> ~Kam (^8*[/color]

No, that would be a big security breach.

The only thing you can do to transmit information between
www.another.com and www.mydomain.com is call the URL with parameters,
for example:

www.mydomain.com?param1=value1&param2=value2

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

  #3  
Old July 20th, 2005, 10:01 AM
Nobody
Guest
 
Posts: n/a
Default Re: Reading Cookie from a different domain?

I could swear that there is a way to do this. You can share cookies with
your other sites in some way (seems to me it involved using IP addresses
instead of domains.) Not really recommended though.

"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:3f57664a$1_2@news.bluewin.ch...
| Hi,
|
| kam bansal wrote:
| > Hi all,
| >
| > Can javascript read a cookie from a different domain? Meaning, if my
| > html page is running on "www.mydomain.com" and I goto another domain
| > "www.another.com" to do some work, and then I come back, can I see the
| > cookie that "www.another.com" created from my domain???
| >
| > Any thoughts?
| >
| > ~Kam (^8*
|
| No, that would be a big security breach.
|
| The only thing you can do to transmit information between
| www.another.com and www.mydomain.com is call the URL with parameters,
| for example:
|
| www.mydomain.com?param1=value1&param2=value2
|
| Laurent
| --
| Laurent Bugnion, GalaSoft
| Webdesign, Java, javascript: http://www.galasoft-LB.ch
| Private/Malaysia: http://mypage.bluewin.ch/lbugnion
| Support children in Calcutta: http://www.calcutta-espoir.ch
|


  #4  
Old July 20th, 2005, 10:02 AM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a
Default Re: Reading Cookie from a different domain?

kam bansal <kam@magickhat.com> writes:
[color=blue]
> Can javascript read a cookie from a different domain? Meaning, if my
> html page is running on "www.mydomain.com" and I goto another domain
> "www.another.com" to do some work, and then I come back, can I see the
> cookie that "www.another.com" created from my domain???[/color]

That depends on security settings.
If you have "disallow third party cookies", then it won't work. Then
"www.another.com" cannot set cookies for other domains than itself.

If not, you can set the cookies with a domain of "mydomain.com".
IIRC:
document.cookie = "dims=data;domain=www.mydomain.com;path=/;expires=..."

/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.