Focusing a parent window
See original GitHub issueI’ve got one window that opens another window. I would like to then, have a function on the new window on a click event that re-focuses the parent window. Here are some things that I’ve tried:
parent.window.opener.focus()
parent.window.focus();
window.opener.focus();
window.blur();
var newWindow = window.open('','_parentName');newWindow.focus();
parent.win.focus();
According to the old window docs, window.opener.focus()
should work, according to the new window docs, win.focus()
should work. So I would think parent.win.focus()
should work. But it doesn’t. Anyone have a work around?
http://docs.nwjs.io/en/latest/References/Window/#winfocus
Edit: on an old version of webkit (0.12.2
I believe) this works: window.open('', '_parentWindowName');
however in 0.13
this does not work anymore.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to return focus to the parent window using javascript?
How to return focus to the parent window using javascript? ; head> ; script type="text/javascript"> ; function openWin() { myWindow=window.open('', ...
Read more >how to keep parent window in focus ? - MSDN - Microsoft
I am doing a window.open to open "page2" . the problem that page2 takes focus and I have to click on first page...
Read more >How to focus Portal(main or parent) window after on click ...
Hi, Once I logged into end user portal, I am opening a popup window using openurlinwindow on click action. Once popup is opened...
Read more >child browser window opened via js cannot focus on parent ...
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)...
Read more >wxChildFocusEvent Class Reference - wxWidgets
A child focus event is sent to a (parent-)window when one of its child windows gains focus, so that the window could restore...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
focusParentSample.zip
Here’s my implementation, tested with nwjs v0.17.1
When I try the implementation on my code, I get
VM2139:1 Uncaught TypeError: Cannot set property 'parentWin' of undefined(…)
. @RohitSharma27 I don’t understand what you mean by a click. I am not doing anything to click the newly opened window. I’m trying to focus the parent window in anonclick=
attribute.