I can't seem to get this to work.
In response to a click, window A opens window B (which then has focus). Then, in response to a click on B, the window calls window.opener.focus()
, but the focus does not go back to A.
I have found a strange, strange workaround for Chrome (29, possibly others).
If I run:
window.opener.name = 'somename';
window.open(window.opener.location.href, window.opener.name);
window.opener.focus();
it does work (and doesn't reload window A). But this doesn't work for Firefox, and it is probably a fluke anyway.
It seems very clear to me what opener
and focus
are supposed to do, but window.opener.focus()
doesn't work. What am I missing?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…