开发者

How to disable HTML5 application cache in Firefox specifically

开发者 https://www.devze.com 2023-03-31 15:31 出处:网络
Since Firefox is prompting the user to store data when using the HTML5 application cache, I want to disable it in Firefox to avoid the prompt notification.

Since Firefox is prompting the user to store data when using the HTML5 application cache, I want to disable it in Firefox to avoid the prompt notification.

One way to do that is serving two different HTML files: one for Firefox with <html> and one for the other browsers with <html manifest=...>.

But for efficiency purposes I want to serve one single static file.

So how do开发者_开发百科 I disable the application cache while serving a file with <html manifest=...> in Firefox?


The manifest attribute isn't checked until the page is loaded. Meaning that you can remove it while the page is loading and the prompt won't appear. Like this:

<script type="text/javascript">
  if (window.navigator.product == "Gecko")
    document.documentElement.removeAttribute("manifest");
</script>

Which of course assumes that all Gecko browsers need to be banned for all eternity because of this prompt. Definitely not nice, particularly because the prompt might disappear at some point in future. But I don't see a proper way to detect whether a browser will prompt the user about storing the web application for offline use.


Use an iframe to install the applicationCache; that way you can prompt a user with a button, and load the iframe once they click on that button.

0

精彩评论

暂无评论...
验证码 换一张
取 消