| [reply] [Watch: Dir/Any] |
You'll have to find an alternative. Setting cookies for other domains would be a huge problem. Imagine a malicious programmer writing a script that would overwrite your cookies for any domain they wish. I'm sure that you can think of plenty of scenarious where this would be disastrous. For example, imagine someone changing your Web-based email account cookie so that you log into a spammer's account. Think of the new dimensions of spam that would be created ...
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
| [reply] [Watch: Dir/Any] |
As others have answered, you can't set a cookie with a different domain. That is a good thing.
But, since you control both domains, you can redirect the browser to a URL in the other domain which then sets an identical cookie. If you need to keep the cookies in sync, it's a pain, but if the cookie doesn't change once it is set (e.g. just holds an ID) it's workable.
Good luck!
-sauoq
"My two cents aren't worth a dime.";
| [reply] [Watch: Dir/Any] |
As people say .. you can't. However, try the following:
1. Create a script setcookie.pl on Server B. It would be something like:
if ($ENV{HTTP_REFERER}=~/ServerA/) {
print "Coookie: ".$ENV{QUERY_STRING}."\n\n";
}
2. On Server A, whenever you set a cookie, send the cookie information to server B by using a javascript like:
var temp=new Image;
temp.src="http://ServerB/cgi-bin/setcookie.pl?$yourCookieString";
The javascript will load the 'image', but it never displays it, thus you'll not get any strange errors. Server B will set the cookie when it is called.
This might not work as is: I've not tried it. However the concept should work. | [reply] [Watch: Dir/Any] [d/l] [select] |
| [reply] [Watch: Dir/Any] |
Are the cookies on the same server?
If so, why not store the data server side -- so the data can be accessed with an md5 hash that you could print on both sites.
If thats not what you're looking for... why not use a hidden frame in a frameset or iframe -- and use javascript to submit forms for both simultaneously? | [reply] [Watch: Dir/Any] |
| [reply] [Watch: Dir/Any] |
If it is realy working please share this solution with me.
Jack Peterson
| [reply] [Watch: Dir/Any] |