javascript/jquery : Window.open opens child window but after few seconds child window get automatically closed for some urls(for IE and chrome)

StackOverflow https://stackoverflow.com/questions/18308464

Pregunta

I have a link on page which opens a new child window(using window.open), but in IE and google chrome browsers new child window opens and close immediately but it is working for some urls.

Here is the js fiddle for the same :

[Demo]http://jsfiddle.net/pJgyu/36395/

As you can see in the js fiddle, when clicking on Login link in Chrome browser child window opens and close immediately but it working for url commented in the code as "https://europay.smart2pay.com/SignIn.aspx".

This works good in firefox but I am getting this issue only in IE and chrome. Can anyone has any idea on what is happening here.

Thanks, Dean

¿Fue útil?

Solución

It's because this code is executed on init on https://wpc.gcsip.com/wpc/wpc page

// check that this page is not in a subwindow (e.g. after a session time out)
if ( window.opener ) {
    window.opener.location = "wpc";
    window.opener.focus();
    window.close();
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top