• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Child window reload problem

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Isn't this like your past questions in here?

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

focus() the window if it exists.

Eric
 
Shashi Iyy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would have to store it with cookies or post the data to the server.

Eric
reply
    Bookmark Topic Watch Topic
  • New Topic