0

I need to open my app in new window by this link:

<a onclick="window.open('http://somesite1.com/', '_target', 'width=510,height=413,resizable=yes,scrollbars=yes').focus();">Link</a>

After opening the application handles events like:

$registerSubmitButton.on("click", function() {
var newWindow = window.open("https://somesite2.com", "_blank");
    newWindow.opener.close();
    return false;
});

But this click event doesn't work only in Safari. Why?

Anastasiia
  • 119
  • 1
  • 13
  • Like this? http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_a_target. Then you can fire a function by onClick. –  May 17 '16 at 14:45
  • Maybe this is relevant to your question? http://stackoverflow.com/questions/4663861/open-new-window-after-a-click-event-not-working-in-safari-chrome – clodal May 17 '16 at 14:48
  • I'm not sure, because, it's okay in Chrome and there are not problems with popup window. Window opens, but there are some problems with js-events – Anastasiia May 17 '16 at 15:01

1 Answers1

0

I am not sure but if you cheat a little bit may this will work. I don't have a safari browser so just a try for you.

<a id="openWindow" onclick="window.open('http://somesite1.com/', '_target', 'width=510,height=413,resizable=yes,scrollbars=yes').focus();">Link</a>

<a id="fakeOpenWindow" style="display: none;" href="https://somesite2.com" target="_blank">

$('#openWindow').click(function(){
     $('#fakeOpenWindow').click();
});
  • Sorry, but in this case the window will be opened by usual link without javascript. I need to open it by my onclick function. – Anastasiia May 17 '16 at 15:03
  • Does not do the same thing like you want to have? I mean the result are basicly the same as you want/expect, or not? I mean its just a suggestion. Thanks for giving it a try :) –  May 17 '16 at 15:09
  • Not exactly. I need to js-open because I'm using some browser security issues, for example, closing the window. And I need to limit window sizes (in onclick width=510,height=413), and it must be a separate small popup window. – Anastasiia May 17 '16 at 15:19