Return focus to parent window w/ Javascript

Discussion of general topics about Mozilla Firefox
Posts: 22
Joined: July 20th, 2004, 7:17 am

Post Posted July 29th, 2004, 7:20 am

I'm not sure which forum this belongs in, so I'll just put it in general.

I've created a popup window that has the following "close window" function:
Code: Select all
<script type="text/javascript">
function closeWin()
This works fine in IE, but it dies in Firefox. The error is "window.opener.focus is not a function." Ehhh... ok, so how do I return the focus to the parent window with Firefox? Been googling for a while and haven't found anything. Also tried window.opener.document.focus(); and
Code: Select all
var parentWin = window.opener;
Every variation returns the same error. Any help is appreciated.

Posts: 3
Joined: December 3rd, 2014, 3:04 pm

Post Posted May 29th, 2019, 10:39 pm

In both parent and child window include the Javascript
Code: Select all
function here() {
var O = window.opener
    if (O)
    else    {
        alert('Welcome Back')

Some browsers are uneasy with that code (asks if user if sure they want to do that)


User avatar
Posts: 44213
Joined: December 7th, 2002, 4:34 am
Location: Australia

Post Posted May 29th, 2019, 11:49 pm

I doubt the OP has been waiting 15 years
What sort of man would put a known criminal in charge of a major branch of government? Apart from, say, the average voter.
"Terry Pratchett"


User avatar
Posts: 27746
Joined: June 18th, 2003, 3:07 pm
Location: Made in Canada

Post Posted May 30th, 2019, 12:22 am

Holy Old Thread Batman!

Return to Firefox General

Who is online

Users browsing this forum: No registered users and 2 guests