View Full Version : OnLoad="window.opener.close();"???

02-20-2006, 04:44 PM
I have a pop up that has a media player in it... and i can get it to open fine... but what i am wanting is for it to close the parent window when it loads without having to click on a link... and also without asking the user if they want to close the parent window. Right now i'm using...

<a href="javascript:opener.close();">Close Previous Window</a>

Is this possible to put inside of the body tag like an onload function? I'm not getting it... Any help would be appreciated.

02-20-2006, 05:20 PM
Nevermind... I got it. It wasn't as hard as I thought it was... In case anyone else may ever be wondering how to do it here is the code...

window.opener = top;

That goes inside the head of the parent window... then this goes in the body tag of the parent window...


02-20-2006, 05:22 PM
If I were you, I'd do it from the parent:
<a href="mediaplayer.html" onclick="window.open('mediaplayer.html');window.close();return false;" target="newwindow">Click</a>

02-23-2006, 01:58 AM
If I were you, I'd do it from the parent:

Well, I would... but this is for a page on myspace and myspace doesn't allow javascript so I had to use a sort of "Transition" page when they clicked on a link. Thanks anyway though.

02-23-2006, 09:07 AM
what? Twey isnt going to say something about how language is deprecated and to use type instead? (the irony of it is, I just got done reading a thread with a post saying language is deprecated, and to use type instead)

02-23-2006, 03:50 PM
Because I advised removing the whole tag. I guess I probably should have mentioned it anyway for information purposes. :)

Nyne: the language attribute is deprecated. Use type instead:
<script type="text/javascript">

02-23-2006, 09:13 PM
You mean to tell me that by changing the Language attribute to Type I can use it on MySpace????

02-24-2006, 04:42 PM
Afraid not. Just for future reference as applied to <script> tags. :)

02-25-2006, 04:54 AM
I guess I misunderstood what you were trying to say. Thanks though.