javascript - Safari --> "Application Cache manifest had an incorrect MIME type: text/plain."

标签 javascript jquery html browser-cache

"Application Cache manifest had an incorrect MIME type: text/plain."

一次又一次收到相同的消息,但我缓存了我的内容。 我遇到此问题的浏览器:IE9/10 和 Safari。 我的 Mozilla 和 chrome 可以正常输出。

代码:

<script type="text/javascript">
  function logEvent(event) {
      alert(event.type);
  }

  window.applicationCache.addEventListener('checking',logEvent,false);
  window.applicationCache.addEventListener('noupdate',logEvent,false);
  window.applicationCache.addEventListener('downloading',logEvent,false);    
  window.applicationCache.addEventListener('cached',logEvent,false);
  window.applicationCache.addEventListener('updateready',logEvent,false);
  window.applicationCache.addEventListener('obsolete',logEvent,false);
  window.applicationCache.addEventListener('error',logEvent,false);

</script>

最佳答案

MIME 类型应该是 text/cache-manifest。这在旧浏览器上是必需的。

This requirement was dropped from the specification some time ago, and no longer required by the latest versions of Chrome, Safari and Firefox, but you'll need the mime-type to work in older browsers and IE11.

A Beginner's Guide to Using the Application Cache

关于javascript - Safari --> "Application Cache manifest had an incorrect MIME type: text/plain.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20210616/

相关文章:

javascript - 使用 Javascript 将厘米转换为英寸

javascript - 如何更改复选框单击行中的输入字段名称

html - 从 NSString 中移除损坏的 HTML 标签

asp.net - 如何处理 $.ajax POST (JQuery) 中的单引号?

javascript - jQuery 延迟直到背景图像加载,然后淡入?

javascript - 每个()函数上的jquery load()一起工作

javascript - 使用ajax改变iframe

javascript - 谷歌图表 html 工具提示问题

javascript - 创建 d3 等值线数据集

javascript - 设置选择选项的默认值