It is time to upgrade your browser! This site looks and acts much better in a newer browser. Go TO THIS PAGE to find LINKS to all the major NEW BROWSERS. The links are at the bottom of the page under "What can I do?"

Or, you may keep reading this ugly page.


[splash image]

MTAA-RR » news » twhid » geek » window opener:

May 02, 2003


posted at 18:10 GMT by T.Whid in /news/twhid/geek

That’s what I learned today.

If you want to reference the main browser window from a pop-up window via javascript you use window.opener. I know, I know, all you code monkeys out there are like, "of course you doofus!" but I’m no javascript master so bite me.

I needed to do it at work and couldn’t remember how to do it. Interestingly enough, if you use target="main" in an anchor tag (after naming the main window via javascript"main") then MSIE Windows and Mac will load the HREF in that main window. But Gecko browsers don’t seem to get it (at least not Mozilla 1.0/Windows). What works is onclick="window.opener.¬
. That seems to work in everything I tested: Safari, Mac IE 5.2, WinIE 6, Moz 1.0. I don’t test in NS 4 as much as I should. I think in this case I will however.

Now you too can reference the main browser window from a pop-up window via javascript. If you feel like leaving comments on why you might want to do this, feel free. permanent link to this post

MTAA-RR » news » twhid » geek » window opener

1997 - 2006 M.River & T.Whid Art Associates. Some Rights Reserved. is licensed under a Creative Commons License with the exception of Website Unseen titles which are covered by agreements with individual collectors and otherwise where noted.