在什么基础上的JavaScript文件缓存? [英] On what basis are javascript files cached?
问题描述
在什么基础上并JavaScript文件获取缓存?说我从一个网站,并在其他网站上我使用相同的名称M-的script.js',但内容不同加载一个名为M-的script.js的文件。将浏览器获取新的,或者只是看名字,并从缓存加载它?同时为M-的script.js文件的URL是不同的(明显)。结果
谢谢你。
On what basis does javascript files get cached? Say I load a file with the name 'm-script.js' from one site and on another website I use the same name 'm-script.js' but with different contents. Will the browser fetch the new one, or just look at the name and load it from the cache? The urls for both the m-script.js file are different (obviously).
Thanks.
推荐答案
如果URL是不同的将不被使用的缓存副本。一个新的请求会被提出,而新文件将被下载。
If the url is different the cached copy will not be used. A new request will be made and the new file will be downloaded.
有将是一个的巨大的安全性和可用性问题与浏览器,如果从一个网站上的JavaScript文件缓存使用另一个。
There would be a huge security and usability issue with the browser if a Javascript file cached from one website was used on another.
这篇关于在什么基础上的JavaScript文件缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!