Reputation: 85765
I have some tabs that are ajax powered. So everytime a tab is clicked all data is loaded including javascripts. So if they click on say Tab A then click on Tab B and finally Tab A. All Tab A scripts will be loaded twice.
Now I am wondering how does the caching work. On the second time they click on Tab A how much faster will these scripts download? Or will it be as slow as the first time?
Thanks
Upvotes: 0
Views: 540
Reputation: 59451
If you are loading the same URL, the browser will use the cached version. If you want to circumvent caching, add "?" followed by a random string to the url every time u call it.
Upvotes: 0
Reputation: 62894
Assuming a fairly regular load, the script will load the first time, and be pulled from the cache from then on.
Unless you're doing something tricky.
Just like you can load a huge script on the first page request of a more traditional site, and include that script of subsequent pages, but after the first page load, the browser will (typically) just pull it from cache.
Use firebug and observe the behavior.
Upvotes: 2