0

I have an application that needs to work in offline mode. However, only part of the application needs to work in offline mode.

I handle the inputs and actions from the user well - in that, I let the user know which actions are not available in offline mode.

My problem is with the entries of the cache manifest

Let us say my index.html file looks like this -

<html manifest="/cache.manifest">
    <body>
        <script src="FirstController.js"></script>
        <script src="SecondController.js"></script>
    </body>
</html>

Now, I only want FirstController.js file because only the page that it deals with is required in offline mode. So I specify it in the cache manifest.

This works. However, I noticed that the browser still tries to load the SecondController.js file.

As a result, my application does not load in IE11. In Google Chrome, I have errors in the console. (this is in offline mode).

How do I tell the browser to ignore SecondController.js if the application is offline?

callmekatootie
  • 10,989
  • 15
  • 69
  • 104

1 Answers1

0

It sounds like you need to edit your cache manifest file so that the relevant file is listed as being an online resource explicitly. You do this with the NETWORK section header in your manifest file:

CACHE MANIFEST

CACHE:
# All your offline resources, e.g.:
/FirstController.js

NETWORK:
/SecondController.js

You can read more about all this stuff in the offline chapter of the Dive Into HTML5 site.

Ben
  • 7,548
  • 31
  • 45
  • I have set the NETWORK section to `*` - according to the DIH site, browser will raise an error which Chrome does. But the application does not load - the rest of the files should allow the app to function properly. – callmekatootie Jan 14 '15 at 13:25
  • DIH on the whitelisted `NETWORK` section (i.e. asterisk): _"That’s a fancy way of saying that anything that isn’t in the appcache can still be downloaded from the original web address, as long as you have an internet connection."_ – Ben Jan 14 '15 at 14:38