Focus on Parent window after closing child window

Hi guys

Wondering if any of yous could help me with this.

I’m having trouble with Safari. After i close a popup it does not focus on the parent window. I have been looking around and i think its this sort of thing i need ‘javascript:window.opener.focus()" target=“_self”’ but tbh i’m not in anyway a javascript whizz, so im a little confused.

Here is my current code to close the child window

document.write(“<input name=‘close’ class=‘button popup’ type=‘button’ value=‘Close Window’ onclick=‘window.close()’ id=‘close’>”

So i need to somehow, add in the .opener thing to that.(:

Any advice is greatly appreciated :slight_smile:

Unless i’m mistaken you should be able to include both your statements in the same onclick event, so:
onclick=“window.opener.focus(); window.close();”

This should first return focus to the window that opened the child, then close the child.

Genius! thanks so much. Works a treat! :slight_smile: