4

I am using AMD style in the ESRI Javascript API (along with the esri application boilerplate: https://github.com/Esri/application-boilerplate-js).

For some reason, the AMD modules from the js.arcgis.com CDN do not appear to be cached and I've been unable to determine why. Local AMD modules are caching fine:

Example responses

Request headers: Remote Address:54.230.50.98:80 Request URL:http://js.arcgis.com/3.10/js/esri/dijit/InfoView.js Request Method:GET Status Code:200 OK Accept:*/* Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Cache-Control:max-age=0 Connection:keep-alive Cookie:rclg0=en; __unam=f220af1-14499213906-3dc5afe-11; esri_auth=[removed by author] Host:js.arcgis.com Referer: [removed by author] User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36

I would suspect this is from the Cache-Control: max-age=0 header, but I have no idea what would be setting that and why.

  • The Cache-Control:max-age=0 is being set by the server. That is what prevents the files from being cached. You cannot control that. – Devdatta Tengshe Sep 24 '14 at 16:06
  • That's being sent in the request which would originate on the client, though. It also doesn't make sense that esri would prevent caching of the modules. – Josh Werts Sep 24 '14 at 16:14
  • Ok I misread your question. Your client's request header shouldn't send that header. Do you have any plugin or something else in your chrome that is attaching this to the request? – Devdatta Tengshe Sep 24 '14 at 16:37
-1

*******Solution Below is Deprecated******

Use the HTML5 App Cache. To your HTML element add the manifest attribute like this

<html manifest="offline.appcache">

Then in the offline.appcache file list the resources you would like to cache. Updating the appcache file will force the browser to make the http request for the resource.

Fore more details see:

https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache

Some of the information contained in this post requires additional references. Please edit to add citations to reliable sources that support the assertions made here. Unsourced material may be disputed or deleted.

  • Just updating this here for anyone reading more recently. The App Cache mentioned in the previous post is Deprecated. “This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible;“... “Be aware that this feature may cease to work at any time.” – iCode Dec 21 '17 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.