Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Pass parameter between pages in different domains (with access to both)

Reply
Thread Tools

Pass parameter between pages in different domains (with access to both)

 
 
WeAreGoing!
Guest
Posts: n/a
 
      12-01-2003
Hello. I need to transfer an MD5 digest number between two pages on
different domains. I know this is generally not possible, but I have full
access on one domain and can insert Javascript at will into tha pages of the
other. I'd like to be able to store the number into a cookie for retrieval
by either set of pages.

I've been racking my brains for a couple of days on this one and just can't
come up with the answer.

Thanks in advance!



 
Reply With Quote
 
 
 
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      12-01-2003
"WeAreGoing!" <> writes:

> Hello. I need to transfer an MD5 digest number between two pages on
> different domains. I know this is generally not possible, but I have full
> access on one domain and can insert Javascript at will into tha pages of the
> other.
> I'd like to be able to store the number into a cookie for retrieval
> by either set of pages.


Instead of trying to dodge the different-domain security settings,
which will probably not work consistently across browsers, or even
survive a patch, I would do something simpler:
Let the page that sets the cookie also load a page from the other
domain. Pass the number in the search string to that page.

You will then end up with different cookies for the different domains,
so you must keep them synchronized.

Example code:
On page in first domain:
---
function setCookieOtherDomain(cookie,returnUrl) {
location.href = "http://www.otherdomain.com/"+
"setCookieFromFirstDomain.html"+
"?cookie="+escape(cookie)"+
"&return="+escape(returnUrl);
}
---
On setCookie page in other domain:
---
<script type='text/javascript'>
function parseInput(input) { // works for search or cookies
var data = {};
if (input == "") {return data;}
var inputs = input.split("&");
for (var i in inputs) {
var parts = inputs[i].split("=");
data[unescape(parts[0])]=unescape(parts[1]);
}
return data;
}
var input = parseInput(location.search.substr(1));
setCookieFunction("cookie",input["cookie"]); // some function you define
location.href = input["return"];
</script>
---
(untested)

Good luck.
/L
--
Lasse Reichstein Nielsen -
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New to Javascript: How can I automate interaction between framecontents from different domains? Ted Byers Javascript 1 08-13-2009 05:41 PM
Show Pages from two different Domains bharath_r ASP .Net 5 04-03-2009 11:47 AM
Automatic sign-up and sign-in between different domains without cookies? Jimmy Javascript 3 11-20-2006 01:28 PM
Sharing login between different domains =?iso-8859-1?q?Nils Hedstr=f6m ASP .Net 2 01-25-2005 02:52 AM
How to pass a parameter between pages? Spongebob ASP .Net 7 02-11-2004 02:40 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57