javascript redirect back to parent page - Stack Overflow

I have a page where opens a child page with javascript. the code is like below:onclick='window.ope

I have a page where opens a child page with javascript. the code is like below:

onclick='window.open("",
        "loginWindonw",
        "width=800,height=600,left=150,top=100"
    );
    return false;'

in the child window, when 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";
                               window.close();
</script>

This works all fine. but Now I want the child window to close and the parent window to refresh. how can I do this? any tips would be appreciated.

I have a page where opens a child page with javascript. the code is like below:

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

in the child window, when 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.";
                               window.close();
</script>

This works all fine. but Now I want the child window to close and the parent window to refresh. how can I do this? any tips would be appreciated.

Share Improve this question edited Jun 3, 2011 at 18:06 bingjie2680 asked Jun 3, 2011 at 17:58 bingjie2680bingjie2680 7,7738 gold badges50 silver badges72 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 2

If I understood well, you want to bring the user back to the same page they opened the logging window from, but first log them in, right? Then you may just want to refresh the page in the parent window after logging in:

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

Pass the return url to the child window, so it can use it instead of mysite.. You can do it through query string

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745299240a4621333.html

相关推荐

  • javascript redirect back to parent page - Stack Overflow

    I have a page where opens a child page with javascript. the code is like below:onclick='window.ope

    12小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信