Javascript redirects back to parent page

I have a page where a child page with javascript opens. The code is as follows:

onclick='window.open("http://mysite.com/pagename",
        "loginWindonw",
        "width=800,height=600,left=150,top=100"
    );
    return false;'

in the child window, when the user logs in, I redirect them back to the main window and close the child window.

<script type="text/javascript">window.opener.location.href="mysite.com";
                               window.close();
</script>

Everything works perfectly. but now I want the child window to close and the parent window to be updated. How can i do this? Any advice would be appreciated.

+3
source share
2 answers

If I understand correctly, you want to return the user to the same page from which they opened the registration window, but first write them down, right? Then you can simply refresh the page in the parent window after logging in:

location.reload(true); // this will reload the page
+2
source

URL- , mysite.com.

window.open("http://mysite.com/pagename?returnUrl=" + window.location.href,
0

All Articles