Ask Experts Questions for FREE Help!
  Advanced
Register  |  Log in  
   Ask    
 Answer  
  Help  

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Internet & the Web   »   Javascript: How to refer to a child window

 
Question Tools Search this Question Display Modes
Question
 
 
#1  
Old Jun 27, 2006, 01:47 AM
xuanmanh's Avatar
xuanmanh
New Member
xuanmanh is offline
 
Join Date: Aug 2005
Location: Hanoi, Vietnam
Posts: 25
xuanmanh See this member's comment history on his/her Profile page.
Send a message via AIM to xuanmanh Send a message via Yahoo to xuanmanh
Javascript: How to refer to a child window

supposing I have opened a new window with this statement:
newwin=window.open("newwin.php","newwindow");

Now I refresh the opener window and I want to know how to refer to the window I have opened?

Reply With Quote
 
     

Answers
 
 
Old Jun 27, 2006, 02:52 AM   #2  
LTheobald
Ultra Member
LTheobald is offline
 
LTheobald's Avatar
 
Join Date: Feb 2004
Location: Cambridge, UK
Posts: 1,047
LTheobald See this member's comment history on his/her Profile page.LTheobald See this member's comment history on his/her Profile page.
Call LTheobald via Skype™ Send a message via MSN to LTheobald
I don't think this is possible but I will do some testing tonight if I get time. When you call window.open, a window reference is stored in memory. Refreshing the page would clear this reference in the memory so that you are unable to reference the window. It might be possible from the child window though. I'll have to try it and see.

Out of curiousity - what are you trying to do?
  Reply With Quote
 
     
 
 
Old Jun 27, 2006, 06:12 PM   #3  
xuanmanh
New Member
xuanmanh is offline
 
xuanmanh's Avatar
 
Join Date: Aug 2005
Location: Hanoi, Vietnam
Posts: 25
xuanmanh See this member's comment history on his/her Profile page.
Send a message via AIM to xuanmanh Send a message via Yahoo to xuanmanh
Thanks alot for yor caring and your nice question. Well, I'm making a website that has user login, logout feature. And user can work on multiple window, then I want whenever user sign on or out on one window, it automaticaly work the same on other windows visually so user don't have to refresh other windows to see that they are also logged in there. Right now I can only use self.opener property to do it if user do login, logout task on children window and I haven't found the way if use do it from parent window, so half of problem has not been solved.
By the way, I've been using ajax for those task.
Do you think that's a good idea?

If you get time, please have a look at my work here http://webmail.vimeco.com The default language is Vietnamese, feel free to click on the 'English' link on top-right of the page. You can find the user login session on the right, try login as user:doanxuanmanh; password:1234
and go to control panel after loging in

Please tell me if you have any idea. thanks
By the way, the page may be slowly loaded, so thankyou for your patient too
  Reply With Quote
 
     
 
 
Old Jun 27, 2006, 10:31 PM   #4  
LTheobald
Ultra Member
LTheobald is offline
 
LTheobald's Avatar
 
Join Date: Feb 2004
Location: Cambridge, UK
Posts: 1,047
LTheobald See this member's comment history on his/her Profile page.LTheobald See this member's comment history on his/her Profile page.
Call LTheobald via Skype™ Send a message via MSN to LTheobald
A better idea would be to use a session to track any information. When the user logins in, a session is created for that user. Then every new window you open could check this session for any information it needs. When the user logs off, the session is terminated.

This way, whatever window you have just needs to check if the user has a session assigned to them. If there is a session for the user then assume they are logged on.

I've no idea if Javascript has a session object but this could certainly be done using cookies anyway.
  Reply With Quote
 
     
 
 
Old Jun 28, 2006, 08:02 PM   #5  
xuanmanh
New Member
xuanmanh is offline
 
xuanmanh's Avatar
 
Join Date: Aug 2005
Location: Hanoi, Vietnam
Posts: 25
xuanmanh See this member's comment history on his/her Profile page.
Send a message via AIM to xuanmanh Send a message via Yahoo to xuanmanh
Sure, I've been using session for years and I don't mean to give it up now. Whenever user sign in or out on a window, that affect all windows in that session. But user can only see it when they refresh those windows. Here I just want user to relize that immediatly and I also want to use this time to get more experience about window interacting
  Reply With Quote
 
     
 
 
Old Jun 29, 2006, 12:13 AM   #6  
LTheobald
Ultra Member
LTheobald is offline
 
LTheobald's Avatar
 
Join Date: Feb 2004
Location: Cambridge, UK
Posts: 1,047
LTheobald See this member's comment history on his/her Profile page.LTheobald See this member's comment history on his/her Profile page.
Call LTheobald via Skype™ Send a message via MSN to LTheobald
I see what you mean. I'll try and find some day to do some tinkering with some code myself and see what I can come up with.
  Reply With Quote
 
     
 
 
Old Jun 30, 2006, 01:25 AM   #7  
xuanmanh
New Member
xuanmanh is offline
 
xuanmanh's Avatar
 
Join Date: Aug 2005
Location: Hanoi, Vietnam
Posts: 25
xuanmanh See this member's comment history on his/her Profile page.
Send a message via AIM to xuanmanh Send a message via Yahoo to xuanmanh
I have the solution for it now, that may not a good solution but it works. I have added a function and set timeout for it so that it is always re-called for each 100 milisecond. This function will monitor its parent window status, once user sign in or out on parent window, my function will relize it and automatically do the task I want.
  Reply With Quote
 
     
 
 
Old Jun 30, 2006, 02:45 AM   #8  
LTheobald
Ultra Member
LTheobald is offline
 
LTheobald's Avatar
 
Join Date: Feb 2004
Location: Cambridge, UK
Posts: 1,047
LTheobald See this member's comment history on his/her Profile page.LTheobald See this member's comment history on his/her Profile page.
Call LTheobald via Skype™ Send a message via MSN to LTheobald
That's probably the easiest way. Bump up the delay though - 100 millisecs is a bit excessive.
  Reply With Quote
 
     


Question Tools Search this Question
Search this Question:

Advanced Search
Display Modes

 
Similar Sponsors

Similar Questions
Question Asker Topic Answers Last Post
Bio father rights/abandonment of child/child support? megan1234 Family Law 6 Apr 25, 2008 08:24 PM
javascript bjblaw Computers for Beginners 1 Apr 20, 2005 06:02 AM
Javascript query Darth_Tanion Internet & the Web 2 Jul 21, 2004 02:51 PM
Javascript and Cookies Darth_Tanion Internet & the Web 0 Apr 26, 2004 09:45 PM
JavaScript jon_m212 Internet & the Web 0 Aug 28, 2003 07:32 AM




Copyright ©2003 - 2007, Ask Me Help Desk.
All times are GMT -8. The time now is 02:26 PM.

Content Relevant URLs by vBSEO 3.0.0 RC6 © 2006, Crawlability, Inc.