Forum Moderators: open

Message Too Old, No Replies

Including .js files

         

kniceguy2know

10:46 pm on Apr 9, 2004 (gmt 0)

10+ Year Member



Hi.
Am new to javascript so this may sound dumb. I just want to know what happens when i include a javascript file in my webpages. Is the file downloaded for each page that includes the script file or does the browser use the copy that was downloaded initially till a fresh visit is started?
Thanks. :)

Rambo Tribble

2:39 am on Apr 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The latter case; the file is cached by the browser, which only initiates a request to the server to confirm the file has not been modified. When it receives the response, (a code 304, if memory serves) the browser uses the cached copy rather than waiting for a new download. You can actually configure the server, if you have access, to set file refresh limits that avoid the modified request, but that's server dependant and probably more than you want to know right now.

kniceguy2know

1:29 am on Apr 11, 2004 (gmt 0)

10+ Year Member



Thanks - that was just what i needed. I had thought as much but i needed confirmation. Ciao!