Link to home
Start Free TrialLog in
Avatar of gbaren
gbarenFlag for United States of America

asked on

Openning a hidden window

I need to open an invisible browser window and have the page loaded in the invisible window write to the document that loaded it.

1. How do I load an invisible window
2. How do I write to the document that loaded it

I'm writing for IE, no need for Netscape compatibility.

Thanks!
Avatar of nimaig
nimaig
Flag of India image

I guess you can have an invisible window only by making use of frames. Say you have a frameset structure something like this

<frameset rows="0,*">
<frame name="frame1" href="page1.html">
<frame name="frame2" href="page2.html">
</frameset>

Now, when you open the page containing the frameset, you can see only one page i.e. page2.html. Page1.html is hidden.

You can write to the document by using

top.frame2.document.write(...)

Hope this helps !!!!!
Avatar of gbaren

ASKER

Thank you for your input, but I already have this working with an <IFRAME>. And I want to avoid a frames page. There are side effects which I am hoping to avoid using a window.
ASKER CERTIFIED SOLUTION
Avatar of a.marsh
a.marsh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gbaren

ASKER

I like it!

One thing: to avoid waiting for the window to open, I will have a script which runs in the new window onLoad event.

How would you write to the document that opened the current window?

Gary
Avatar of a.marsh
a.marsh

You want to "write" content to the parent window you mean?

Well to access the parent window you use:

window.opener

and then you can do things like:

window.opener.document.write("Hello!");
window.opener.document.close();

That will of course completely overwrite the page currently being displayed.

A common thing is to redirect the parent window e.g.

window.opener.location = "nextpage.html";

:o)

Ant
Avatar of gbaren

ASKER

Ahh... window.opener - great!

I'm writing for IE, what I need to write is:

window.opener.document.<DivName>.innerHTML = "some text"

Actually, this is for domain name registration, the "some text" will be either a red X or a check box. It works from an IFRAME, it's just that each time I load the IFRAME, the calling document gets repositioned.

Thanks!
My pleasure - thanks for the A!

:o)

Ant