JavaScript 卡在缓存中
我有一个 HTML 文档,我正在为其开发一个 .js
文件。我的问题是,我的浏览器仍在使用过时版本的 .js
脚本,该脚本在使用时存储在缓存中。对实际 .js
脚本的任何修改都没有影响。清除缓存没有帮助...我该如何解决这个问题?
I have a HTML document which I am developing a .js
file for. My problem is, my browser is still using an outdated version of the .js
script, which it stored in the cache when it was used. Any modifications to the actual .js
script make no difference. Clearing the cache didn't help... How can I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,对不起各位。事实证明,问题是完全不相关的......我有一些来自旧的(不需要的)
.js
脚本的重叠函数,这些函数优先于我正在编辑的脚本。问题解决了:)
Ok, sorry guys. Turns out the problem was something totally unrelated... I had some overlapping functions from an old (unneeded)
.js
script, which were taking priority over the one I'm editing.Problem solved :)
您是否尝试过使用 filename.js?v=2,然后又更改了 filename.js?v=3?
另一种可能是,您附加了错误的文件,而不是您正在编辑的文件。
重新启动浏览器?但我不怀疑,是这个问题。
如果文件位于远程服务器上,请尝试再次上传,然后下载文件并检查更改。也可能是服务器上的缓存机制,因此如果您有权限,请尝试重新启动apache。
您可以添加更多代码吗?
Did you try with filename.js?v=2, and after another changes filename.js?v=3?
Another possibillity is, that you attached wrong file, not this what you're editing.
Restart the browser? But I dont suspect, its this issue.
If the file is on remote server, try uploading again, and then download the file and check for the changes. It may be caching mechanism on the server too, so try to restart apache if you've got permissions.
Can you add more code?
重命名服务器上的文件。加载页面。确保它没有找到该脚本。将脚本重命名回其原始名称。测试一下它是否正确加载。
如果失败,可能需要重新启动您的网络服务器。
Rename the file on the server. Load the page. Ensure that it didn't find the script. Rename the script back to its original name. Test to see of it loads properly.
If this fails, it may be time to reboot your web server.