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 02 Answers
Reset to default 2If 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
评论列表(0条)