简体   繁体   English

Magento JS和CSS的更改无法反映

[英]Magento js and css changes not reflect

I had problem that i added custom java script its included but when i changes its contents it doesn't effect. 我有一个问题,我在其中添加了自定义Java脚本,但是当我更改其内容时却没有效果。 it runs older java script file. 它运行较旧的Java脚本文件。 since i cleared cache. 因为我清除了缓存。 i deleted every folder of /var/ also. 我还删除了/ var /的每个文件夹。 but still it runs older java script code. 但它仍运行旧的Java脚本代码。 while i see it in uploaded file also it shows updated code but using URL of that java script in browser it shows old code. 虽然我在上传的文件中看到了它,但它也显示了更新的代码,但是在浏览器中使用该Java脚本的URL时,它显示了旧代码。 I flushed magento cache storage. 我刷新了magento缓存存储。 flushed cache of css/javascript also. 还刷新了CSS / JavaScript的缓存。

In case if any guy have solution let me know. 如果有人解决方案,请告诉我。

Thanks in advance. 提前致谢。

EDITED 已编辑

Same problem with css also. CSS也有同样的问题。 Changes doen't reflect. 更改不会反映出来。 cleared cache a lot of times from back-end as well as cleared var folder also. 从后端清除缓存很多次,也清除了var文件夹。

Your server probably have header information asking browsers to cache static files like JS/CSS. 您的服务器可能具有标头信息,要求浏览器缓存JS / CSS之类的静态文件。 It is likely that your browser is still caching the old CSS files. 您的浏览器可能仍在缓存旧的CSS文件。 One way to check if it is indeed the browser and not say accidentally editing the wrong CSS file is by enabling and disabling (only go one way to check) the CSS file merge. 检查是否确实是浏览器而不是不小心编辑了错误的CSS文件的一种方法是启用和禁用(仅一种检查方式)CSS文件合并。 By doing so you are forcing the browser to fetch for a whole new file - essentially bypassing caching. 这样,您将迫使浏览器获取一个新文件-本质上是绕过缓存。

You may also want to take a look at our CSS/JS Versioning extension which includes automatic refresh of the file name hash based on CSS/JS file timestamps (sensitive to editing and changes) http://extensions.activo.com/css-and-javascript-versioning.html 您可能还需要看一下我们的CSS / JS版本控制扩展,其中包括基于CSS / JS文件时间戳(对编辑和更改敏感)的文件名哈希值的自动刷新,网址为http://extensions.activo.com/css-和-javascript-versioning.html

Have you cleared your local browser cache on your workstation? 您是否清除了工作站上的本地浏览器缓存?

Often, CSS and JavaScript can stick mightily and no matter now much you flush Magento caching on the server, the workstation browser never requests and downloads the new script. 通常,CSS和JavaScript可能会粘在一起,无论您现在在服务器上刷新Magento缓存多少,工作站浏览器都永远不会请求和下载新脚本。 These are static files, a change in file date doesn't trigger browser reload, only complete removal from the browser cache does. 这些是静态文件,文件日期的更改不会触发浏览器重新加载,只有从浏览器缓存中完全删除才可以。

Usually CTL-F5 about three times will do it, otherwise you have to go into the web browser setups and flush browser cache there. 通常,CTL-F5大约会执行三遍,否则,您必须进入Web浏览器设置并刷新浏览器缓存。

Also, if you're using JavaScript/CSS Merge, you need to click the button on the Cache Management page to Flush JavaScript/CSS Cache as well. 另外,如果您使用的是JavaScript / CSS合并,则还需要单击“缓存管理”页面上的按钮以刷新JavaScript / CSS缓存

The only other place things can gum up is if you're running APC cache, you may need to flush it as well so the block caching for the head can refresh. 唯一可能困扰的地方是如果您正在运行APC缓存,则可能还需要刷新它,以便磁头的块缓存可以刷新。 This only matters if you changed the script and CSS file names, which you probably haven't, so it likely doesn't matter. 这仅在您更改了脚本和CSS文件名(可能没有用)的情况下才有意义,因此可能无关紧要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM