Closed
Bug 370225
Opened 18 years ago
Closed 14 years ago
child browser window opened via js cannot focus on parent via window.opener.focus
Categories
(Firefox :: Tabbed Browser, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: vgatsuk, Unassigned)
Details
(Whiteboard: [CLOSEME 2010-11-15])
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1
I use javascript to create new child window and set its opener as in:
<script language=javascript>
function openWindow() {
BFWin = open('display/somepage.php', 'BFWin');
BFWin.opener = window;
}
</script>
After that in child window, I try to focus on parent window using javascript:
<script language=javascript>
function focusOnParent() {
var pw = window.opener;
if (pw && !pw.closed ) {
//pw.alert('wha?');
window.blur();
pw.focus();
window.close();
}
}
</script>
Note if I uncomment pw.alert line - it works and alerts the right parent tab, meaning I have a correct parent object window as opener.
However if I call the function on child window - it closes child and goes to the right-most opened tab INSTEAD of parent. Very uncool.
So js window.opener.focus() doesn't work in FF 2.0.0.1 (linux ubuntu OS)
Reproducible: Always
Steps to Reproduce:
1. see details
Actual Results:
right-most tab gains focus instead of parent
Expected Results:
parent tab should gain focus
Comment 1•18 years ago
|
||
Make sure you have "Options > Content > Advanced > Allow scripts to: raise or lower windows" checked. Depending on the event (see bug 355482), web pages are not always allowed to call focus() by default.
Btw, you don't need the line "BFWin.opener = window;". The "opener" property is set automatically.
Comment 2•14 years ago
|
||
This bug was reported using Firefox 3.0 or older, which is no longer supported. The bug has also not been changed in over 500 days and is still in UNCO.
Reporter, please retest this bug in Firefox 3.6.10 or later using a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles. If you still see this problem, please update the bug. If you no longer see the bug, please set the resolution to RESOLVED, WORKSFORME.
This is a mass search of unconfirmed bugs that have no activity on them, so if you feel a bug was marked in error, just remove the CLOSEME comment in the whiteboard within the next month.
Whiteboard: [CLOSEME 2010-11-15]
Comment 3•14 years ago
|
||
No reply, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
Comment 4•7 years ago
|
||
Hey guys, I run into same bug. I can't bring focus on parent window from child.
OS: MacOS 10.12.6 (16G1036)
Firefox: 57.0.1 (64-bit)
Could you please confirm is it some security block, or a bug that should be fixed?
Flags: needinfo?(tdowner)
Comment 5•7 years ago
|
||
There is also a couple of duplicates/similar issues: https://bugzilla.mozilla.org/show_bug.cgi?id=357379, https://bugzilla.mozilla.org/show_bug.cgi?id=416771
Updated•7 years ago
|
Flags: needinfo?(tdowner)
You need to log in
before you can comment on or make changes to this bug.
Description
•