[英]My codes don't apply until I press Ctrl+F5, and sometimes don't work eitherly
please help me on this, when I code (Html, Sass/css, Javascript), the changes don't apply until I press "Ctrl+F5" it happens every time I want to work again on my project, Im making WordPress costume theme And I use Xampp, VS code and Microsoft chromium based browser as my tools, I thought the problem from Xampp but when I install my theme on my online host, HALF OF CHANGES (STYLES AND JAVASCRIPT FUNCTIONS ) APPLIED, then I pressed Ctrl + F5 the changes applied again, I don't know what to do, please help.请帮我解决这个问题,当我编写代码(Html、Sass/css、Javascript)时,更改不适用,直到我按下“Ctrl+F5”时,每次我想再次处理我的项目时都会发生这种情况,我正在制作 WordPress 服装theme And I use Xampp, VS code and Microsoft chromium based browser as my tools, I thought the problem from Xampp but when I install my theme on my online host, HALF OF CHANGES (STYLES AND JAVASCRIPT FUNCTIONS ) APPLIED, then I pressed Ctrl + F5 再次应用更改,我不知道该怎么办,请帮助。 until today my Javascript doesn't work its like I didn't write any Javascript code.
直到今天,我的 Javascript 都无法正常工作,就像我没有编写任何 Javascript 代码一样。
In some few cases it's not enough to reset with F5 or even CTRL-F5.在少数情况下,使用 F5 甚至 CTRL-F5 重置是不够的。 Here helps to really delete the cache in your browser.
这有助于真正删除浏览器中的缓存。
If you use Chrome than you can disable in preferences the cache while using DevTools.如果您使用 Chrome,则可以在使用 DevTools 时在首选项中禁用缓存。 This helps me sometimes.
这有时对我有帮助。 The little loss of perfomance doesn't bother me for testing.
性能上的一点点损失并没有打扰我进行测试。
For achieve this on Chrome press F12 for opening the DevTools and than open the settings .要在 Chrome 上实现这一点,请按F12打开 DevTools,然后打开设置。 There click on the preferences and mark disable cache .
点击首选项并标记禁用缓存。
It seems like a HTTP Caching problem: https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching好像是 HTTP 缓存问题: https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching
If you have the control over the HTTP server(nginx, apache or something like that), change the response header to include a Cache-Control: no-cache
.如果您可以控制 HTTP 服务器(nginx、apache 或类似的东西),请更改响应 header 以包含
Cache-Control: no-cache
。
If you don't have the control over the HTTP server, you can adding a version number parameter to the URL.如果您无法控制 HTTP 服务器,您可以在 URL 中添加版本号参数。
For example:例如:
Before a.js
changed:在
a.js
更改之前:
<script src="http://example.com/a.js?v=1"></script>
After a.js
changed: a.js
更改后:
<script src="http://example.com/a.js?v=2"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.