Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15069 > unrolled thread

Settings cookie cross domain

Started byWilli Langer <willi.langer@gmail.com>
First post2012-07-16 16:48 +0200
Last post2012-07-16 23:28 +0200
Articles 2 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  Settings cookie cross domain Willi Langer <willi.langer@gmail.com> - 2012-07-16 16:48 +0200
    Re: Settings cookie cross domain Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-07-16 23:28 +0200

#15069 — Settings cookie cross domain

FromWilli Langer <willi.langer@gmail.com>
Date2012-07-16 16:48 +0200
SubjectSettings cookie cross domain
Message-ID<ju19k8$9s9$1@dont-email.me>
Hi all,
I have a few questions:

1- in a web page, if I include a javascript hosted on a remote server, 
can it set a cookie in my domain?

i.e.
WWW.MYSITE.COM
<script src="http://www.externalsite.com/my.js">….

Can it set a cookie having domain mysite.com?

2. can a javascript set a cookie in a domain different of the one who 
hosted it?

Thanks in advance and sorry for my english.
W.

[toc] | [next] | [standalone]


#15081

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-07-16 23:28 +0200
Message-ID<1347098.Vh9zOZxn27@PointedEars.de>
In reply to#15069
Willi Langer wrote:

> 1- in a web page, if I include a javascript hosted on a remote server,
> can it set a cookie in my domain?
> 
> i.e.
> WWW.MYSITE.COM
> <script src="http://www.externalsite.com/my.js">….

The proper TLD for examples is `example', not `com', because a `com' domain 
might be used.  See RFC 2606.
 
> Can it set a cookie having domain mysite.com?

Yes.  Just try it (in many browsers) and you will see.
 
> 2. can a javascript set a cookie in a domain different of the one who
> hosted it?

Yes, if the other domain belongs to the same sub-level domain.

> Thanks in advance and sorry for my english.

There is also a German-speaking newsgroup on this subject, 
de.comp.lang.javascript, where your questions will be as welcome.  See also 
<http://dcljs.de/>.


PointedEars
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web