Javascript - how to get focus back in opener window -


my parent window calls child window , moves focus it. works fine. on child window want set focus parent window child window. works if use alert/confirm on parent window. don't want users click away alert popups time. there opportunity move focus back?

parent-window calls child:

function openwindow() {     child = window.open("zlab/child", '_blank'); } 

parent-window sends message , sets focus on child:

function sendmessage() {     child.postmessage({ param: new date() }, "/");     child.focus(); } 

child-window calls parent-window

function openparent() {     opener.getback(); } 

parent-window gets control back. window.focus() doesn't focus, alert/confirm works.

function getback() {     alert("hi, again");     //window.focus(); } 


Comments