问题描述
我正在为一个网站使用JavaScript,使用Firefox进行开发,当我刷新页面时,我没有看到我的更改。 JavaScript文件位于外部文件中。我重新加载并刷新了多次页面,但旧的JavaScript文件仍然被缓存。最后,我直接在浏览器中加载JavaScript页面,看到旧脚本,点击重新加载,看到我的更改。
如何清除缓存的外部JavaScript文件?当我告诉客户端所做的更改时,我也需要知道这一点,以便他们没有看到旧的缓存功能。在Firefox中,您可以安装名为 Web Developer Toolbar 的插件,该插件有一个<$ c $ c> appcache clear command
我认为没有办法通过编程来实现,但是您可以使用类似于
< script type =text / javascriptsrc ='js / my.js?x =<?php echo rand (0,100)?>'>< / script>
I'm working on JavaScript for a site, developing with Firefox, and when I refresh the page, I don't see my changes. The JavaScript file is in an external file. I reloaded and refreshed the page several times, but the old JavaScript file was still cached. Finally, I loaded the JavaScript page in the browser directly, saw the old script, hit 'reload', and saw my changes.
How can I clear cached external JavaScript files? I'll need to know this also when I tell the client that the changes are made, so that they aren't seeing the old cached functionality.
In Firefox you can install a plugin called Web Developer Toolbar which has a appcache clear
command
I think there is no way to do it programmatically but you could give a hint to the browser using something like
<script type="text/javascript" src='js/my.js?x=<?php echo rand(0,100) ?>'></script>
这篇关于清除缓存的JavaScript包括在Firefox中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!