1

I've used the following example from this post:

function whenClicked() 
{
    window.close();
    opener.location.href = "http://www.somesite.com";

}

but amended to this:

function openLink()
{
    window.close();
    opener.location.href = this.href;
}

to open a link from a popup window. This works fine in IE, FF, Chrome & Opera but Safari doesn't want to play ball. Firstly, my popup window doesn't work, it opens in a new tab (but that's another issue) and when I click the link, the tab closes but the new link doesn't open.

Any ideas?

Edit:

Added an if statement to detect Safari and deal with it for now but a solution would be ace!

function openLink()
{
    if (isSafari = !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)) {
            opener.open(this.href);
        }
    else {
        window.close();
        opener.open(this.href);
    }
}
Community
  • 1
  • 1
Kungfauxn00b
  • 567
  • 2
  • 5
  • 14
  • Ideally you should post your solution as an answer rather than editing the question if you have enough reputation. – Liath Mar 16 '15 at 11:17

0 Answers0