Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass 100k of data between windows in separate domains via js 1

Status
Not open for further replies.

macknox

Programmer
Feb 1, 2001
32
0
0
US
Within our intranet I have multiple domains. Domain ABC has our directory, and domain XYZ needs to read data on 30 people (3k per person in XML). So I have a browser window that pops off a window that interprets the query and creates a 100k XML string that needs to be returned to the page.

If the return string were smaller, I could encode it into the URL. I could set up a POST to a cgi program that would transfer the data, but that's something of a job for the backend guys. What I would like to do is set up some sort of a semaphore system that would allow me to send 100 URL's each with 1k in the GET parameters. I would accumulate the string back into a single message, and go about my merry way.

Has anyone heard of a way of doing anything remotely like this?

Thanks

Kevin
 
FYI: The solution was to create a cross domain cookie that abc.xyz.com and def.xyz.com could both read, and pass the information from window to window via the cookie. Works like a champ.

Kevin
 
Kevin,

That sound great!

Now how the heck do you create a 'cross domain cookie'?!!

-pete
 
You were able to hold 100K of data in a cookie? I thought the limit was much smaller than that. Does this work for IE and Netscape?

Pretty cool, anyway
 
Dude how do you create a "cross domain" cookie?
I don't think that's possible, since cookies
were designed to be opened by 1 browser and then also
only if they are at the correct domain so I have serious doubts about your solution ...

But please tell me if I'm wrong ok

Cheers
 
>How do you create a cross-domain cookie:

If you are running "search.abc.com" and "found.abc.com", you can create a cookie with a domain parameter of '.abc.com', and both of the domains will be able to read it as if it were their own. (Using IE 5.0. You mileage may vary).

Through trial and error, I also discovered that if search.xyz.com sets a cookie for anything.abc.com, neither of the domains will be able to read the cookie at all. This little trick only works for passing stuff between two related subdomains, and it only works if there are at least 2 dots in the full domain name. Abc.com cannot make a cross domain cookie called .com, and hope to read it from xyz.com. There must be at least 2 dots worth of identical data in the domain name.

>How did I pass 100k of data when there's a 4k limit per domain:

Yeah, this was a frustration. I originally that there was a 4k limit per cookie, so I created 25 cookies (cookie_1, cookie_2, etc). When I would look at the cookie, all I would see was the last cookie I had created, cookie_25. More amusingly, when I did successfully create a 100k cookie, the browser would report a server error. Evidently, when the browser passes a 100k cookie to the server, it chokes and rejects the page to prevent a buffer overflow attack.

I eventually settled upon a pair of timing loops. The parent window sets the cookie to &quot;<!--Waiting-->&quot; and then checks back every 500ms to see if the cookie has changed. When the child window has some data, it makes sure the cookie says &quot;<!--Waiting-->&quot;, then loads it with 2k of data. It then waits 50ms and checks for the cookie to be empty to receive more data. The parent window sees the change, then loads the packet and sets it back to waiting again and begins checking every 50ms. This goes on until all 100k of data are passed, at which time the child window sets the cookie to &quot;<!--Done-->&quot; and closes itself.

Sure, it's inefficient, but it beats not being able to pass data from domain to domain, and it is actually working. Of course, we are in an Intranet environment, and everyone is on 100mb ethernet, so it's pretty easy to pass larger chunks of data.

Kevin
 
Kevin -

Just thought I would let you know that there is a 10 cookie per domain limit on some browsers. this would nuke your idea of 25 cookies. theEclipse
eclipse_web@hotmail.com
**\\||It was recently discovered that research causes cancer in rats||//**
 
One of the advantages of coding for an Intranet. I know I am coding for IE 5.x. Of course, the idea was nuked anyway, but thanks for the pointer. Some day I hope to move out into the wilds of free-range browsers.

Kevin
 
dont we all? theEclipse
eclipse_web@hotmail.com
**\\||It was recently discovered that research causes cancer in rats||//**
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top