window.location.reload();不适用于Google Chrome [英] window.location.reload(); not working for Google chrome

查看:1392
本文介绍了window.location.reload();不适用于Google Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在获取响应后使用AJAX操作,我想重新加载当前页面,我正在使用它:

I am using AJAX action after getting the response, I want to reload the current page, for which I am using:

 window.location.reload();

它在Firefox和IE上运行良好,但它不适用于Chrome;我希望显示的内容为空。

It works fine on Firefox and IE, but it's not working for Chrome; the content which I want display empty.

有没有办法在Chrome中重新加载页面?

Is there way to reload the page in chrome?

window.opener.document.location.reload();
self.close();


推荐答案

不知道为什么,但在我的情况下,我修复了它通过在100毫秒的setTimeout中包装reload()调用。

Not sure why, but in my case i fixed it by wrapping the reload() call in a setTimeout with 100 ms.

setTimeout(function(){
    window.location.reload();
},100); 

这篇关于window.location.reload();不适用于Google Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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