User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 373,931 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,272 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 18554 | Replies: 13
Reply
Join Date: Mar 2008
Posts: 1
Reputation: sprash is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sprash sprash is offline Offline
Newbie Poster

Re: Parent/Child Windows References

  #11  
Mar 20th, 2008
Originally Posted by mleneveut View Post
Hi,

I have the same problem, and I can't achieve to serialize my popup reference.

I tried with JSON and a lot of different libraries :

var popupVar = window.open('url', 'name');
var serializedString = JSON.encode(popupVar);
var serializedString = popupVar.toJSONString();
...

Every time I have errors. I could catch it with IE, and it says : [Object error]. Great :p
In Firefox it just crashs it...

I did'nt find any real example on serializing JS "native" objects, only JS "created" objects (like var Person = { this.id; this.name; })

Does someone achieve it ? Know how to serialize this popupVar ?

Thanks a lot


Hi,
I have the exact same java script issue where even if my parent window reloads, it should still be able to hold the child window references. Did you manage to get a solution for that. Any help would be appreciated.
Thanks in Advance.
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,731
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 323
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: Parent/Child Windows References

  #12  
Mar 22nd, 2008
> even if my parent window reloads, it should still be able to hold the child window
> references.

AFAIK, you simply can't. To put it in simple terms, the Javascript variables disappear after a page reload. After all Javascript is a client side technology.

A work around would be to store all the information you need to maintain inside a cookie i.e. whether the child window was open or not and if yes then what were it's contents; at the same time being aware of the 4KB limit imposed on the cookie size.
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Join Date: Sep 2005
Posts: 611
Reputation: digital-ether will become famous soon enough digital-ether will become famous soon enough 
Rep Power: 5
Solved Threads: 38
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Practically a Master Poster

Help Re: Parent/Child Windows References

  #13  
Mar 22nd, 2008
Originally Posted by ~s.o.s~ View Post
> even if my parent window reloads, it should still be able to hold the child window
> references.

AFAIK, you simply can't. To put it in simple terms, the Javascript variables disappear after a page reload. After all Javascript is a client side technology.

A work around would be to store all the information you need to maintain inside a cookie i.e. whether the child window was open or not and if yes then what were it's contents; at the same time being aware of the 4KB limit imposed on the cookie size.


You can't store a popup window reference in a cookie as it is directly dependent on the current parent window/document which is a javascript host object.
However, if you could persist the current window to the next reload in the browser, you could also persist reference to open windows, and other objects (dependents).

Unfortunately I cannot release the code for this right now, as I would like to, as we have a patent pending. I will try and get this code out in ASAP as I know this is needed in many areas of web development, especially the web2.0.

As soon as we get the patent sorted you will be able to persist references to host objects in javascript between the loading of new windows.

At the moment I am interested in any other methods that may have been discovered to do this, though I have not found any so far.

-- update:

I'll add some code to demonstrate persistence of javascript native and host objects after I get it tested in a majority of browsers and OS's.
Last edited by digital-ether : Mar 22nd, 2008 at 11:19 am.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,731
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 323
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: Parent/Child Windows References

  #14  
Mar 22nd, 2008
Originally Posted by digital-ether View Post
You can't store a popup window reference in a cookie as it is directly dependent on the current parent window/document which is a javascript host object.
However, if you could persist the current window to the next reload in the browser, you could also persist reference to open windows, and other objects (dependents).

Read my post carefully; I talk of persisting the child window 'information' and not the child window itself which seems to make little sense.

You could store information like the child windows' attributes like its height, width, position etc. in a cookie. On a document load, your javascript function would then check the contents of the cookies and then re-create a child window based on the flag 'recreateNeeded' which would be either true or false or 0 or 1 (the way you want it to be). Of course this means persisting the child window information at regular intervals and writing a custom mini parser which would parse the contents of the cookie at load time but yes, it's very much possible with a bit of effort .
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 6:07 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC