开发者

Repeated loading of JSONP doesn't work in Safari, Chrome

开发者 https://www.devze.com 2023-02-01 13:15 出处:网络
I\'m using JSONP to load frequently updating score data from my CDN. The JSONP file is loaded via a single URL which never changes from request to request. It works without issue in Firefox and IE, bu

I'm using JSONP to load frequently updating score data from my CDN. The JSONP file is loaded via a single URL which never changes from request to request. It works without issue in Firefox and IE, but in Webkit (Safari and Chrome specifically), I'm seeing the file only getting loaded off the server once; after that, the file -- and its old data -- is simply reloaded from cache in these browsers.

I can prevent this behaviour by throwing a random number at the end of the URL (or otherwise making the request unique), but then our CDN (Akamai) would simply forward the request from each and every user and开发者_StackOverflow社区 our origin servers would melt.

Does anyone know of any other way to do JSONP efficiently with a CDN?


Your problem is the Cache-Control: you are telling Akamai (which tells your browser) how long to keep the version of the file. You have to figure out ahead of time how long the current version of the file and have your webserver set the Cache-Control header correctly.

It's a complicated subject, but your Akamai rep can help (mine helped me).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号