bcm*_*cfc 5 safari .htaccess caching
我有一个页面,一旦单击一个按钮,它将被Ajax微调器替换,同时用户等待下一页加载.
我正在使用.htaccess控制(或试图控制)缓存.如果用户点击(浏览器按钮,鼠标按钮,alt + left,退格键),则需要从缓存中重新加载页面.IE 6-8和Chrome都很好用.Firefox暂时没有工作,最近开始工作,但问题似乎仍然存在于Safari中.这看起来有点奇怪,因为我预计Safari和Chrome会以同样的方式运行.
这是我的.htaccess文件:
# Add Proper MIME-Type for Favicon
AddType image/x-icon .ico
<IfModule mod_expires.c>
ExpiresActive On
# ExpiresDefault A2630000
ExpiresByType image/x-icon A2630000
ExpiresByType image/gif A2630000
ExpiresByType image/jpeg A2630000
ExpiresByType image/png A2630000
ExpiresByType application/x-javascript M2630000
ExpiresByType application/javascript M2630000
ExpiresByType text/css M2630000
</IfModule>
<IfModule mod_headers.c>
Header set Cache-Control "public"
<FilesMatch "\.php$">
Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0"
</FilesMatch>
</IfModule>
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/javascript
Run Code Online (Sandbox Code Playgroud)
我已经尝试过使用和不使用Cache-Control公共线路.
我也尝试过添加:
AddType application/x-httpd-php .php
Run Code Online (Sandbox Code Playgroud)
有:
ExpiresByType application/x-httpd-php A0
Run Code Online (Sandbox Code Playgroud)
无济于事.
我错过了一些明显的东西吗
编辑:我认为这与缓存设置无关.
我已经尝试将其添加到PHP本身:
#safari test
if (strstr($_SERVER['HTTP_USER_AGENT'],'Safari')){
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
}
Run Code Online (Sandbox Code Playgroud)
即使没有这些行,我也可以在"inspect element">资源中看到正在接收正确的标题.问题似乎是Safari正在与他们合作以成为"最快的浏览器".它似乎明确地忽略了网站开发人员的具体内容 - 这听起来就像IE在当天用于布局的表格中的原始思维方式.