Reputation: 17681
As I understand it, whether an item is cached by the web browser is determined by:
Cache-Control
and Expires
).How does this differ for files served from a network file-share? Across different browsers? Consider this JavaScript include:
<script type="text/javascript" src="\\SOMECOMPUTER\folder\file.js"></script>
Will browsers obey a meta
tag such as this one when network files are involved?
<META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 31 Dec 2011 11:12:01 GMT">
I'm finding very little documentation on this topic.
Upvotes: 5
Views: 559
Reputation: 15758
HTTP headers are only considered while the file is sent through HTTP protocol. The file access (both local and network share) are NOT going through HTTP, so you cannot control the cache with this.
HTML files has the cache control in the <head>
section with meta tags. So, if you want to control the cache for the .html file, you can do it. The above is unfortunately not true for .js files, you cannot control the js file caching this way.
I would recommend 2 options:
<script>...</script>
tags), and control the caching by <meta>
tags. This way you can load this file in a <div src="\\server\cachedfile.html" \>
- the div could be even hidden after loading.I think that the second option is better, because the <meta>
cache control is more reliable and even more controllable.
Upvotes: 1
Reputation: 804
Edit: After actually doing some more tests, you can access the file that way with IE8, Firefox, and Google, assuming the proper permissions are setup, sorry for prior confusion.
Now its just back to the matter of will it cache java-script files (or any really), which is yes. So here's how you could fix that:
Using <meta> tags to turn off caching in all browsers? (This seemed to work fine for me so it appears that the browsers will listen to the meta tags for network files like this)
How to force IE to reload javascript? (This works just like how you would avoid caching ajax calls by appending the time to it as an unused variable)
Upvotes: 4