编程语言
首页 > 编程语言> > javascript-Safari->“应用程序缓存清单的MIME类型不正确:文本/纯文本.”

javascript-Safari->“应用程序缓存清单的MIME类型不正确:文本/纯文本.”

作者:互联网

“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

标签:html5,browser-cache,javascript,jquery
来源: https://codeday.me/bug/20191122/2059812.html