This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Javascript file loading  RSS feed

 
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
We know that if we have included a js file in an html/jsp file, an on opening same url in different browser window, everytime js file is loaded along with page. But i want it to store in browser cache and i want that only one time, js should be loaded, and if same url is requested, its js should not be loaded with page and page use same old ones from browser cache.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The external javascript files are designed to be cached by the browser. If they are not being cached, then it is most likely the browser settings are looking for a new version on every visit.

Eric
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, I know that if the browser is set to cache everything and only check for new content with a new browser instance, it is possible to set headers to make sure a page or a file is never cached (of course the browser has to recognize the headers, but it works with IE and Firefox). But is it possible to do the opposite - to force the browser to cache a resource even if the settings are "check for new content every visit to the page."

For example, if I have the same image displayed hundreds of times on a page, I don't care what the browser settings are - I don't want hundreds of requests for that image coming to my server from the same client.

-Yuriy
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!