Click to See Complete Forum and Search --> : OK this is a really tricky one, need help bad!


d2tw4all
03-27-2003, 01:22 PM
Ok I need to be able to close any open child windows without knowing their handles. Basically I have a kiosk that runs local html with javascript that runs IE in fullscreen with a frame around it and loads a normal web site in the bottom of the frame with custom navigation buttons in the top of the frame. The kiosk is locked down as it's for public access, and thus you can't alt-tab, alt-f4, etc... Also open in new window is disabled, but javascript can still generate a new child window and does in many places. Each window can have a different handle depending on what site it is on, but they are always children of the local framed page which I have control to edit. The issue is that if someone opens a child window, it's not maximized, and if they click on the main parent window it goes to the background, but without alt-tab, alt-f4, or minimize you can't get back to the child again. I want to add an onfocus command in the frames so that if they leave the child window it closes it automatically, but without knowing the handle I can't find anything on this. Anybody have a CLUE as to how to accomplish this? I guess what I need is a way to close ANY child windows of a parent without knowing their handles or by finding their handles, whatever might be possible... Boy is this a stumper!
Tom

d2tw4all
03-27-2003, 03:02 PM
BUMP, nobody has any ideas huh?
CRUD!
Tom

havik
03-27-2003, 03:11 PM
uh...without knowing their handles or finding their handles? How you going to reference it when you close them? That's very tricky and I'm sure there's some way it could be done.

If you don't need the child windows to stay up permanently, then you could have a timer that'll close them after a given amount of time.

Also, why can't you close the windows from themselves?
<a onclick="window.close()">Close this window</a>

Or am I way off here? :confused:

Havik

d2tw4all
03-27-2003, 03:16 PM
Basically I have no control over the page that actually calls the child windows. Think of it this way, you make a computer and some html that loads a frame and then pulls up say www.yahoo.com in the main frame. This page runs in full screen mode so that people can't mess up the computer, which is locked down. If you go to a link that opens a new window, it works fine, but if you don't close the new window and instead click back on the main frame, the focus changes to the main frame and the child window goes behind, where you can't get at it, and any subsequent open in new window code simply opens in the child window that you can no longer see. I can't change the code of the main site that you are getting the new window from, only the overall parent that has the frames, therefore I never know what the handle is of a given child as depending on the site it varies. If there were a way to GET the handles of any child windows that might do it, but I have yet to find anything that will do that for me. Is this all clear or am I not presenting the problem well?
Tom

havik
03-27-2003, 03:41 PM
I get the problem. I'm not sure exactly how to do this. Even if there was a way to get the handles, you could look at the code for them or ask for them, I don't think you can access them anyways. So like you said, that's not really an option.

The only thing I can think of is some sort of universal event handler that will detect the opening of any web page regardless of the source. This way you could detect the child window opening and when the user clicks on the main page, you could make the child window close on its own. You know what I mean about this?

I'll do a search for something like this and get back to you.

Havik

d2tw4all
03-27-2003, 03:47 PM
Ok you def. have the idea, however I still think it's possible if I could get the child handles we could close them as the parent document IS the locally stored htm file, only a frame is calling the child, but the whole document should have access and be considered the parent. However I do like your universal handler idea, if there is some way to detect any IE windows that open, that would be EXACTLY what I'm looking for! Thanks for your help!
Tom