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

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

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

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


当前回答

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浏览器)。

其他回答

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浏览器)。

如果您在开发人员工具中对javascript进行本地更改,则需要确保在重新加载页面之前关闭这些更改。

在Sources选项卡中,打开脚本,右键单击脚本,然后从上下文菜单中单击“Local modification”选项。这将显示您已保存修改的脚本列表。如果您在该窗口中看到它,开发人员工具将始终保留您的本地副本,而不是从服务器刷新它。点击“恢复”按钮,然后再次刷新,你应该得到新的副本。

下面是DevTools的快捷方式:

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

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

Shift+F5快速清空缓存。

你也可以使用这个Chrome扩展来快速切换使用或不缓存:https://chrome.google.com/webstore/detail/cache-killer/jpfbieopdmepaolggioebjmedmclkbap