.js files 
Author Message
 .js files

Does anyone know exactly how .js files really work? I've read that if you
include it with "<SCRIPT SRC=asdf.js></SCRIPT>" in multiple pages it will
get downloaded by the first page and the subsequent pages will read it out
of the browser cache. I have looked in my cache however and there are no .js
files in there.

To test it I also created a pretty sizable .js file (~2M), included it in
several pages and tried downloading them. By checking the bytes transferred
I can see that the file is getting retrieved from the server every time. I
can also see in my IIS logs that there is a "Get" performed on that file
every time I load a page.

I have tried changing my Temp Internet Files Settings to check for newer
versions "never" and it still seems to retrieve the file every time. If this
is the way to fix it however I wont be able to take advantage of it since
the app requires pages to be retrieved on every visit. Is there something
I'm missing or is all the documentation I've seen just wrong?



Wed, 23 Jul 2003 07:05:44 GMT  
 .js files

Quote:

> ...Is there something I'm missing or is all the
> documentation I've seen just wrong?

Your observations mesh with mine. I eventually came to the conclusion that
includes are a better approach, since .js files don't really get cached, and
there's no way for your JS to load out of sequence when using includes.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.



Wed, 23 Jul 2003 07:14:51 GMT  
 .js files
I don't know what's different, but all my .JS files are in my cache. I KNOW
they are because I have to use F5-refresh or Right-Click->refresh to get the
new versions w/o closing and reopening the browser.

Unless your syntax was abreviated.. I use
<script language=JavaScript src="......filename.js"></script>


Quote:

> > ...Is there something I'm missing or is all the
> > documentation I've seen just wrong?

> Your observations mesh with mine. I eventually came to the conclusion that
> includes are a better approach, since .js files don't really get cached,
and
> there's no way for your JS to load out of sequence when using includes.

> --
> Dave Anderson

> Unsolicited commercial email will be read at a cost of $500 per message.
Use
> of this email address implies consent to these terms.



Wed, 23 Jul 2003 11:21:08 GMT  
 .js files
My IIS logs show that the file is requested (GET) every time, however the
return code from the server is 304 - Not Modified. The browser uses it form
the cache.
-Michael

Quote:

> Does anyone know exactly how .js files really work? I've read that if you
> include it with "<SCRIPT SRC=asdf.js></SCRIPT>" in multiple pages it will
> get downloaded by the first page and the subsequent pages will read it out
> of the browser cache. I have looked in my cache however and there are no
.js
> files in there.

> To test it I also created a pretty sizable .js file (~2M), included it in
> several pages and tried downloading them. By checking the bytes
transferred
> I can see that the file is getting retrieved from the server every time. I
> can also see in my IIS logs that there is a "Get" performed on that file
> every time I load a page.

> I have tried changing my Temp Internet Files Settings to check for newer
> versions "never" and it still seems to retrieve the file every time. If
this
> is the way to fix it however I wont be able to take advantage of it since
> the app requires pages to be retrieved on every visit. Is there something
> I'm missing or is all the documentation I've seen just wrong?



Wed, 23 Jul 2003 11:27:31 GMT  
 .js files
Make sure there aren't any meta tags forcing the browser to reload the page
....  (also check your IE settings :)

-TH


Quote:

> > ...Is there something I'm missing or is all the
> > documentation I've seen just wrong?

> Your observations mesh with mine. I eventually came to the conclusion that
> includes are a better approach, since .js files don't really get cached,
and
> there's no way for your JS to load out of sequence when using includes.

> --
> Dave Anderson

> Unsolicited commercial email will be read at a cost of $500 per message.
Use
> of this email address implies consent to these terms.



Thu, 24 Jul 2003 11:07:22 GMT  
 .js files
You could use the following workaround:

Create a frameset with a hidden and a visible frame.
Load the reused js in the hidden frame (using COLS=0,&).
Only use the visible frame for loading your pages.

You can then make calls to the javascript in the hidden frame
from any pages loaded into the visible frame.

Quote:

> Does anyone know exactly how .js files really work? I've read that if you
> include it with "<SCRIPT SRC=asdf.js></SCRIPT>" in multiple pages it will
> get downloaded by the first page and the subsequent pages will read it out
> of the browser cache. I have looked in my cache however and there are no .js
> files in there.

> To test it I also created a pretty sizable .js file (~2M), included it in
> several pages and tried downloading them. By checking the bytes transferred
> I can see that the file is getting retrieved from the server every time. I
> can also see in my IIS logs that there is a "Get" performed on that file
> every time I load a page.

> I have tried changing my Temp Internet Files Settings to check for newer
> versions "never" and it still seems to retrieve the file every time. If this
> is the way to fix it however I wont be able to take advantage of it since
> the app requires pages to be retrieved on every visit. Is there something
> I'm missing or is all the documentation I've seen just wrong?



Thu, 24 Jul 2003 16:31:57 GMT  
 .js files
I am using the script as below. I did have "reponse.Expires = 0" in the asp
that included the .js file. I took that out but that didnt help at all. I
still see no .js files in my cache and my IIS logs show the "Get" on the .js
files getting a 200 status (Sent ok). I even tried setting my refresh page
to "never" in IE5.5 (which I dont want) and rebooting. When I tried again,
just visiting the same page refreshed my cache very randomly. Every 2 or 3
times it would do a succesful get even though the page hadnt changed, and I
still didnt see any .js files in there. I'm starting to think somehow the
.js files are only getting loaded into Memory since I searched my drives and
found no relevant local .js files. I know there are ways around this problem
(hidden frames, and includes) but I just want to figure out how this thing
works. The scant documentation Ive seen just says that it works but doesnt
say how exactly it needs to be set up. Does anyone have this working and if
you do, do you actually see .js files in your cahce?? Does anyone know the
specific location of any extensive MS documentation about this?

Also, has anyone tried putting .js files into a .jar file and including
that? I'd be curious to know if it works like a .cab file that has activeX
objects in it (downloaded once until a new version is specified).


Quote:
> I don't know what's different, but all my .JS files are in my cache. I
KNOW
> they are because I have to use F5-refresh or Right-Click->refresh to get
the
> new versions w/o closing and reopening the browser.

> Unless your syntax was abreviated.. I use
> <script language=JavaScript src="......filename.js"></script>




> > > ...Is there something I'm missing or is all the
> > > documentation I've seen just wrong?

> > Your observations mesh with mine. I eventually came to the conclusion
that
> > includes are a better approach, since .js files don't really get cached,
> and
> > there's no way for your JS to load out of sequence when using includes.

> > --
> > Dave Anderson

> > Unsolicited commercial email will be read at a cost of $500 per message.
> Use
> > of this email address implies consent to these terms.



Sat, 26 Jul 2003 00:52:16 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Include JS file from JS file

2. including js file inside an js file

3. using jar file to store JavaScript (.js) files

4. .js files- jar files

5. Import two jscript file in another js file

6. including other .js files in my script file

7. Executing .js files like .bat files

8. How to use WSH object in js file called from Html file

9. Calling VBS file from JS file

10. help! how to include a .js file in a .js file...?

11. How can I include another .js file in a js file?

12. How can I include another .js file in a js file?

 

 
Powered by phpBB® Forum Software