[thelist] External javascript files and caching
rudy
r937 at interlog.com
Sun Sep 9 18:11:42 CDT 2001
> If we put the code in external .js files, will the browser
> cache the file or download it on each subsequent visit
> to a new page that contains the .js reference?
hi mark
it will look in the cache
works same as an image
the only situation where it might try to download is if the
urls are coded differently, even though they may be pointing
to the same file
for example, the external file
<script language="JavaScript" type="text/javascript"
src="/foo.js"></script>
might point, ultimately, to the same external file as
<script language="JavaScript" type="text/javascript"
src="../../foo.js"></script>
although i think the browsers actually resolve the url first
so even in these cases the cache copy would be used
rudy
More information about the thelist
mailing list