资源管理器9上的html5视频缓存

html5 video caching on Explorer 9

本文关键字:视频 缓存 html5 上的 资源管理器      更新时间:2023-09-26

我有一些<video>,它们是动态创建的&使用javascript document.createElement加载,然后我使用屏幕外画布对它们进行采样并对它们进行处理。

所有这些都很有趣,在每个浏览器中都能很好地工作。。。。等等…除了IE9(惊喜)。

问题是:当我清除缓存并重新加载IE时,一切都很好,然而当视频被缓存时,IE开始抱怨a:

DOM Exception: SECURITY_ERR (18) 

我现在已经阅读了互联网上关于这一点的所有内容,基本上这是IE的愚蠢,因为这个错误实际上是关于CORS的,这不可能是CORS问题

所以问题是:

有没有一种方法可以使用.htaccess强制IE9(并且只有IE9)阻止IE9缓存视频,或者我必须对视频文件名进行小马查询?

真的非常感谢!

编辑:答案

除了FlavorCape下面的答案外,在对他的链接进行了一些参考实验后,这个代码似乎是有效的:

BrowserMatchNoCase "MSIE" isIE
<IfDefine isIE>
    ExpiresByType video/ogg                 "access plus 0 seconds"
    ExpiresByType audio/ogg                 "access plus 0 seconds"
    ExpiresByType video/mp4                 "access plus 0 seconds"
    ExpiresByType video/webm                "access plus 0 seconds"
</IfDefine>

当我访问不想缓存的东西时,我通常会在文件名中添加一个查询字符串。

例如:

someVideo.mp4?poop=Math.Round( Math.random()*10000)

您可以在服务器头上设置无缓存。参见参考

以下是.htaccess中的操作方法http://www.askapache.com/htaccess/apache-speed-cache-control.html

Cache-Control   = "Cache-Control" ":" 1#cache-directive
    cache-directive = cache-request-directive
         | cache-response-directive
    cache-request-directive =
           "no-cache"                          ; Section 14.9.1
         | "no-store"                          ; Section 14.9.2
         | "max-age" "=" delta-seconds         ; Section 14.9.3, 14.9.4
         | "max-stale" [ "=" delta-seconds ]   ; Section 14.9.3
         | "min-fresh" "=" delta-seconds       ; Section 14.9.3
         | "no-transform"                      ; Section 14.9.5
         | "only-if-cached"                    ; Section 14.9.4
         | cache-extension                     ; Section 14.9.6
     cache-response-directive =
           "public"                               ; Section 14.9.1
         | "private" [ "=" <"> 1#field-name <"> ] ; Section 14.9.1
         | "no-cache" [ "=" <"> 1#field-name <"> ]; Section 14.9.1
         | "no-store"                             ; Section 14.9.2
         | "no-transform"                         ; Section 14.9.5
         | "must-revalidate"                      ; Section 14.9.4
         | "proxy-revalidate"                     ; Section 14.9.4
         | "max-age" "=" delta-seconds            ; Section 14.9.3
         | "s-maxage" "=" delta-seconds           ; Section 14.9.3
         | cache-extension                        ; Section 14.9.6
    cache-extension = token [ "=" ( token | quoted-string ) ]

或者,您可以尝试设置无缓存文档头,但我认为这只适用于文档本身。