Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is the call to include javascrip in HTML document cached?

 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I apologize in advance if this is a newbie question.

I'm including json data in .js file in my web application.
I put this in the head element of the html page:


My question: Is the above somehow cached in the browser? Or does it load every time the page is load?
Based on my observation, it looks like it doesn't get cached since it takes long time to load every time.
I'm trying to see if there's a way I can make it cached since the JSON data is pretty big and takes some time to load.

Thank you for the advice.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64980
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"JavaScript" not "javascrip"

Usually, yes, .js files will be cached. But there a lot of variables that can affect that including the browser settings, and the response headers sent by the server.

You can determine this for yourself with a tool that shows the HTTP request being sent and received (HttpFox is one I know of off the top of my head).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic