Javascript:无需完全重新加载即可刷新父页面 [英] Javascript: Refresh parent page without entirely reloading

查看:35
本文介绍了Javascript:无需完全重新加载即可刷新父页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户通过fancybox (javascript) 弹出窗口登录后,我希望重新加载父页面,以便他们可以访问登录的功能.

After a user has logged in via a fancybox (javascript) popup I wish to reload the parent page so they can access the logged in features.

目前我正在这样做:

<a href="javascript:window.top.location.reload(true)" class="continue">Continue</a>

这很好用,但唯一的问题是它完全重新加载了整个页面:重新下载所有 css &javascipt等

This works great, but the only issue is that it completely reloads the entire page: redownloads all the css & javascipt, etc.

我想要做的就是正常重新加载页面,而不是完全刷新.我怎样才能做到这一点?

All I want to do is reload the page normally, not a full refresh. How can I achieve this?

(我不知道确切的 URL,因为可以通过fancybox 从任何页面进行登录,所以我无法对 URL 进行硬编码.)

(I do not know the exact URL because the login can be done from any page via the fancybox, so I can't hardcode the URL.)

推荐答案

我在 facebook graph api 中看到的另一种重新加载页面的方法如下:

Another way of reloading the page i have seen in the facebook graph api is the following:

window.location = window.location

或者你的情况:

window.top.location = window.top.location

此解决方案会重新加载页面,而不会尝试重新发送 POST 请求.可能有用.有关更多信息,请查看以下 SO 问题.

This solution reloads the page without trying to resend a POST request. Might be useful. for more information look at the following SO question.

这篇关于Javascript:无需完全重新加载即可刷新父页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆