3

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?

6
  • There is a dom.storage.enabled setting in about:config that should do what you want. Commented Aug 26, 2011 at 18:52
  • @Marc: I don't think that he wants to disable it in his personal web browser. Commented Aug 26, 2011 at 18:56
  • "one single static file". Since that means the server can't mangle the file, that leaves changing browser settings. Commented Aug 26, 2011 at 18:58
  • @Marc B: I was speaking from a web developer perspective. Since your setting is a user setting and a global setting I won't be able to change it as a website Commented Aug 26, 2011 at 19:00
  • Then you'd need to do something dynamic on the website. Some browser sniffing and serve up the cache-free version to any browser claiming to be Firefox. Commented Aug 26, 2011 at 19:03

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

2 Comments

this works. thousand thanks. I was subconsciously falsely assuming that it would be checked before the loading of the page:). Yeah I would love to enable appCache for Firefox but to me the prompt is a no go which btw from my perspective is kind of a flaw of Firefox
window.navigator.product is "Gecko" in Safari and Chrome too! Also the fact that this works seems to be an accident, against HTML5 spec, which says that "Application cache selection happens in the HTML parser." (w3.org/TR/html5/browsers.html#read-html)
2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.