使用JS刷新浏览器窗口

问题描述:

我正在尝试使用以下代码刷新浏览器窗口:

I am trying to refresh the browser window using the following code:

window.location = window.location.href;

但它不会刷新窗口,但是当我尝试这样做时:

but it doesn't refresh the window, however when I try to do this:

window.location = "http://www.google.com";

它会将我重定向到Google。谁能告诉我这里我做错了什么?为什么不刷新浏览器窗口?

It does redirect me to Google. Can anyone please tell me what I am doing wrong here? Why doesn't it refresh the browser window?

使用 window.location.reload(),它确实如此。