aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Child window reload problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Child window reload problem" Watch "Child window reload problem" New topic
Author

Child window reload problem

Shashi Iyy
Greenhorn

Joined: Jun 12, 2008
Posts: 18
Hi All,

I have the following scenario :

There is a link in the parent window.When I click on the link,a child window containing a textarea pops up.I enter some text in the textarea of the child window and then minimize the child window.When I click on the link again in the parent window,the focus comes to the child window and the child window reloads.As a result of the reload,the contents of the textarea of the child window get lost.I have the following 2 questions based on the above scenario :

1) How to prevent the disappearance of the textarea contents in the child window when the link in the parent window is clicked again using Javascript?
2) How can you prevent the reload of a window using Javascript?

Please help me in resolving the above questions.A example would be a much better option.
Thanks in advance.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Isn't this like your past questions in here?

http://www.coderanch.com/t/427996/HTML-JavaScript/Parent-Child-window-relationship

focus() the window if it exists.

Eric
Shashi Iyy
Greenhorn

Joined: Jun 12, 2008
Posts: 18
Hi,

The scenario mentioned here by me is different as compared to the other questions posted by me.The contents of the child window basically needs to be retained when it is reloaded from the parent window several times.Please help me in this regard.

Thanks in advance.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The same basic idea applies, if it is open already, you just focus the window into view [windowName.focus()]. There is no reloading of the child like you did in the other questions.

If you reload the window, there is no way to force the browser to keep the data unless you start storing data in cookies.

Eric
Shashi Iyy
Greenhorn

Joined: Jun 12, 2008
Posts: 18
Hi,

Thanks for all your replies.Based upon your suggestions,I have some questions :
1) Does a window.open() reloads the popup window everytime the window.open() is called?Basically,in our code,whenever the link in parent window is called,the window.open() is always called.Is this creating problem?
2) Is there any other way to store data other than storing in cookies?

Thanks in advance.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
1) If window.open is called with the same window name, it will reuse the window and open up the page again.
2) If you take my advise and do the check to see if the window is open than you just need to do winPop.focus(), there would be no need to store the data.

[Note do not keep starting new threads on the same topic.]

Eric
Shashi Iyy
Greenhorn

Joined: Jun 12, 2008
Posts: 18
Thanks for the replies.I am able to now retain the contents of the child window.But,I have some other problem related to this.

When the parent window gets refreshed,due to some activity in the window,with the child window minimized,and then click on the link again,the child window gets reloaded and the contents of the child window get lost,which should not happen.

I have some questions on the above scenario :

1) Can we retain the unsaved contents of a child window when the parent window gets refreshed?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You would have to store it with cookies or post the data to the server.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Child window reload problem