我有一个角度应用程序,它对服务器进行HTTP GET调用.它适用于Chrome& Firefox浏览器.但是,我发现IE缓存了GET响应,在我执行POST后,我需要调用相同的GET请求并获取新的更新响应,但IE会缓存它.我想禁用IE的缓存.
我试过用了
我试过用了
'If-None-Match': '*'
解决方法
HTML
<Meta http-equiv="Pragma" content="no-cache"> <Meta http-equiv="Cache-Control" content="no-cache"> <Meta http-equiv="Expires" content="Sat,01 Dec 2001 00:00:00 GMT">
要么
JS
if (!$httpProvider.defaults.headers.get) { $httpProvider.defaults.headers.common = {}; } $httpProvider.defaults.headers.common["Cache-Control"] = "no-cache"; $httpProvider.defaults.headers.common.Pragma = "no-cache"; $httpProvider.defaults.headers.common["If-Modified-Since"] = "0";