Can cookie be shared in 2 sites in this way ??

U

up3000

I just worte code in this way in my login.htm with javascript,
login.htm resides in websitea

document.cookie ='Data=' + escape(AccountStr + "|" + CheckStr +
"|" + IndexStr + "|" + AccountType + "|") + "; expires=" + expire
s.toGMTString()+' Path=/ ;' +"Domain=www.websiteb";

my goal is to share user's loginfo between websitea and websiteb.
in my option , Domain is set for websiteb. so when user try to browser
any webpage in websiteb , cookie will be transfer to server side . The
websiteb can get login's info that user filled in login,htm

in fact . i am not sure it can works . i searched online for
solutions. there have lots of way
to solve it,but all of that depend on ablility of server side such as
redirect. since i am in apache + mod_$mycmod context in which there
was no such facility. I have to find a new way to solve my problem.

Any help is welcome
 
V

VK

Can cookie be shared in 2 sites in this way ??

No, unless you find a really bad browser with a really broken security.
Any help is welcome
Set cookies by both Server A and Server B.
Or spuff the browser using server-side redirect.
 
T

Thomas 'PointedEars' Lahn

I just worte code in this way in my login.htm with javascript,
login.htm resides in websitea

document.cookie ='Data=' + escape(AccountStr + "|" + CheckStr +
"|" + IndexStr + "|" + AccountType + "|")

Are you aware that with this expression the delimiter character
will be escaped (to %7C) as well? You are rather looking for

escape(AccountStr) + "|" + escape(CheckStr) +
"|" + escape(IndexStr) + "|" + escape(AccountType) + "|")
+ "; expires=" + expire
s.toGMTString()+' Path=/ ;' +"Domain=www.websiteb";

my goal is to share user's loginfo between websitea and websiteb.
[...]

If all depends on the specific domains and on the domain parameter, see

<http://wp.netscape.com/newsref/std/cookie_spec.html>


Your spelling and punctuation leaves room for considerable improvement.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top