PDA

View Full Version : New hidden window?


forlamp
04-14-2004, 10:45 AM
Hello, this might be a bit of a doosey, but..

does anyone know of a method to open a new window, or frame, have it invisible (not visible to the user, no task bar icon/etc), and have it affect contents of the parent frame? (the window that opened it)

In effect, i need a 'thread' if you will that will auto-refresh X times a minute and notify the main window of events that it detects...

any ideas?

-fl

agent002
04-14-2004, 11:15 AM
you need JavaScript skills of some sort to do that. You need to use window.opener to access the opener window, window.opener holds it as an object. For instance,
if(window.opener && !window.opener.closed){
// function doStuff() in the opener window:
window.opener.doStuff();

// element on page in opener window
window.opener.document.getElementById('stuff').value = 'blah';
}
:)

forlamp
04-14-2004, 11:28 AM
ok, so i use window.opener.* to reference the parent window from the new one.. ok so that solves the issue partially, the next issue being..

how do i open that new window, with no options avilable, minimal size,...

actually i want the new window to be INVISIBLE the user shouldn't be able to close this or switch to it or do anything with this window.. im not sure if using a new window to do this is even necessary...

Basically, what i want to happen is.. i need something that queries a URL every say.. 30 seconds WHILE the user is browsing within the url.. but i can't refresh the page cuz the page will be doing its own thing regardless of this 20 timer event.. now depending on the results of that URL query, the 'query-er' will send/change data on the main page... know what i mean?

-fl

agent002
04-14-2004, 11:34 AM
You can't open a window that the user doesn't notice. But a frameset with a 0% and a 100% frame sounds like a pretty good solution to you?
<frameset cols="0,*" rows="100%" border="0">
<frame src="hidden.html" name="hidden">
<frame src="visible.html" name="visible">
</frameset>
:)

forlamp
04-14-2004, 11:38 AM
so you're saying if i create a frame with dimensions of 0, 0... it will not affect the browser? and there wont be any borders?.. i guess i can set the border tag..

and then i use what.. targetid.document.* to access all the elements in the main window?

i really dislike frames ;p

-fl

agent002
04-14-2004, 11:40 AM
Frames generally just have bad sides, if using them for your site design. But in this case, it sounds like your best option. You might need to add frameborder="0" to both <frame> tags too, also yes, you use framename.* to access the frames.

forlamp
04-14-2004, 11:54 AM
hrm ok i'll give that a shot.. now what's the best method for page refreshing? use of the meta tag?

btw, thanks for your help :)

-fl

forlamp
04-14-2004, 11:59 AM
actually, is there a way to have that frame loop.. continously .. cuz seeing as it doesnt need to display any HTML, if i just stay within the header can i create a loop, which hits a db (remote), and then parses the info received from it?

hrm... tricky tricky tricky

-fl

agent002
04-14-2004, 12:08 PM
Unless I've missed something, you only need the serverside script (that you want refreshed with intervals of 30 seconds) in the hidden frame. Make it print a basic page with
<meta http-equiv="Refresh" content="30">
between the <head> and </head> tags to refresh it automatically.

forlamp
04-14-2004, 12:09 PM
indeed, thinking about it that's probably how i am going to have to do this.. this will be fun to write :)

-fl