星期三, 3月 28, 2007

IE 裡 XMLHttpRequest 的 cache

在 IE 裡使用 XMLHttpRequest 時會被 cache (沒有遵守 Cache-Control 的 no-cache 參數),這個問題不會太大 (因為很好解,解法也不會破壞其他遵守規定的 Browser),解法是在 Cache-Control 外多送出幾組 header:
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
Expires: Mon, 1 Mon 1990 00:00:00 GMT
Last-Modified: 現在的時間

這樣在 IE 上就會正常了。

沒有留言: