我真的很喜欢在chrome调试器中编辑javascript的能力,然而,我发现让调试器从服务器重新获取javascript真的很有问题。

有时我不得不关闭调试器并重新加载帧,但其他时候(dI不能确定在什么情况下发生),我必须清除我的临时互联网缓存。有时我发誓我必须完全关闭chrome浏览器,然后清除缓存,然后在调试器最终显示最新的脚本之前加载页面。

(NB。web服务器没有缓存脚本)

我想知道是否有人知道一个快速和简单的方法来告诉调试器无效所有的javascript,并重新获取它在页面重载?


当前回答

下面是DevTools的快捷方式:

F12打开Chrome DevTools F1,打开DevTools Settings 勾选“禁用缓存”(当DevTools打开时),如下所示:

注:根据Dimi的评论更新。他们倾向于移动它,所以让我知道,或者更新帖子,如果你注意到它的变化。

其他回答

当你在开发你的脚本时,试着禁用Chrome缓存。

当您重新加载页面时,JavaScript现在应该会刷新。


铬大约2011年


铬大约2018年

你也可以在network选项卡上访问它:

如果您正在加载的文件被缓存,如果您所做的更改没有反映在代码中,那么有2种方法可以处理这个问题

像所有人说的那样清空缓存 如果你想要缓存,只有文件需要重新加载,你可以去开发工具的网络选项卡,并清除加载的任何文件。下一次它将不会从缓存中加载它。您将有最新的更改。

It seems as the Chrome debugger loads source files into memory and wont let them go despite of browser cache updates, i.e. it has its own cache apart from the browser cache that is not in sync. At least, this is the case when working with source mapped files (I am debugging typescript sources). After successfully refreshing browser cache and validating that by browsing directly to the source file, you download the updated file, but as soon as you reopen the file in the debugger it will keep returning the old file no matter the version from the ordinary browser cache. Very anoying indeed.

我认为这是chrome的一个bug。我使用版本46.0.2490.71 m。

唯一有帮助的是重新启动chrome(关闭所有chrome浏览器)。

对于谷歌chrome,它不是Ctrl+F5。按Shift+F5清除当前缓存!这对我很管用!

在我看来,在chrome的“私人浏览会话”中工作是最简单的,以确保你的javascript文件不是来自缓存。