• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I Want to Cache bulk of js files.

 
Greenhorn
Posts: 21
Eclipse IDE Firefox Browser Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi , I am including a lot of js files in JSP. It tooks too much of time to load. I want to cache the JS files.

For Example:

I have a JSP namely -> MyFirstDemo.jsp
In MyFirstDemo.jsp i have 10 js files included.
I am accessing this MyFirstDemo.jsp many times. it took long time to load because of js files. i want to reduce the time taken for the JSP to load all those js files.

Is there any way to do this.

Thanks in Advance.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JS files should be cached by the browser. You can use a tool like the LiveHttpHeaders Firefox extension to ascertain whether or not those files are transferred again after the first page load. If they are, make sure the browser's cache isn't turned off, that proper last-modification dates are sent for the JS files, and that HTTP pipelining isn't turned off in the browser.

You could also combine those files into fewer than 10 files, but I doubt that that will make a big difference if caching and HTTP pipelining work properly.
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Senthil,
When you say "include", do you mean referencing internal files or rendering their contents in the page. If the former, I agree with Ulf that they should be cached. If not, it is best to use the format:
<script language="JavaScript1.1" src="[your file].js"></script>
This allows the browser to cache the file between requests from the same client.
 
Senthil Kumar
Greenhorn
Posts: 21
Eclipse IDE Firefox Browser Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Guys..

I have included my JS Files like this.

<script language="JavaScript1.1" src="[your file].js"></script>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic