Ask Experts Questions for FREE Help !
Ask
    xuanmanh's Avatar
    xuanmanh Posts: 24, Reputation: 1
    New Member
     
    #1

    Jun 27, 2006, 02:47 AM
    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?
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #2

    Jun 27, 2006, 03:52 AM
    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?
    xuanmanh's Avatar
    xuanmanh Posts: 24, Reputation: 1
    New Member
     
    #3

    Jun 27, 2006, 07:12 PM
    Thanks a lot 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 logging in

    Please tell me if you have any idea. Thanks
    By the way, the page may be slowly loaded, so thank you for your patient too :)
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #4

    Jun 27, 2006, 11:31 PM
    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.
    xuanmanh's Avatar
    xuanmanh Posts: 24, Reputation: 1
    New Member
     
    #5

    Jun 28, 2006, 09:02 PM
    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 immediately and I also want to use this time to get more experience about window interacting
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #6

    Jun 29, 2006, 01:13 AM
    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.
    xuanmanh's Avatar
    xuanmanh Posts: 24, Reputation: 1
    New Member
     
    #7

    Jun 30, 2006, 02:25 AM
    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.
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #8

    Jun 30, 2006, 03:45 AM
    That's probably the easiest way. Bump up the delay though - 100 millisecs is a bit excessive.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Bio father rights/abandonment of child/child support? [ 6 Answers ]

I am 6 weeks pregnant and the father is my ex boyfriend. I reached out to him 3 different times to see how he felt about this and what his interest would be in terms of involvement with his child. He has been quite verbally hostile and told me to die and other choice things. What time frame...

Javascript [ 1 Answers ]

Does internet explorer support javascript anymore? I sometimes get that question from a site. Thank you. Brenda.

Javascript query [ 2 Answers ]

I have a website I have created and some of the links open in new windows. This is simple enough to do. I have used the code: <a href="wherever.html" target="new.window"> but the problem is that I have no control over the size of the window. I would like them to come up in a small window that...


View more questions Search