I'm trying to get HTML 5 offline application cache working with an ASP MVC 3 website. The problem I get is that when I try to navigate to a page in offline mode, it doesn't work.
I am using an action for the manifest file so that it can be dynamically generated, and in the view I specify the Resonse.ContentType = "text/cache-manifest".
I have hosted the application locally in IIS so I'm using http://192.168.55.127/mywebsite/ to access it.
This is the manifest view I'm using. It uses the razor view engine and is a bit messy (hard coded URL etc) while I try to figure out what's wrong.
@{
Layout = null;
Response.ContentType = "text/cache-manifest";
}
CACHE MANIFEST
# Version: @ViewBag.Version
CACHE:
#Script Files
@foreach(var jsFile in Url.GetJsFiles())
{
@string.Format("{0}{1}\r\n", "http://192.168.55.127", Url.Content(jsFile))
}
#Style Sheets
@foreach(var cssFile in Url.GetCssFiles())
{
@string.Format("{0}{1}\r\n", "http://192.168.55.127", Url.Content(cssFile))
}
#Images
@foreach(var imageFile in Url.GetImageFiles())
{
@string.Format("{0}{1}\r\n", "http://192.168.55.127", Url.Content(imageFile))
}
#HTML Pages
@string.Format("{0}{1}", "http://192.168.55.127", Url.Content("~/pages/master.htm"))
@string.Format("{0}{1}", "http://192.168.55.127", Url.Content("~/pages/home.htm"))
@string.Format("{0}{1}", "http://192.168.55.127", Url.Content("~/pages/options.htm"))
NETWORK:
*
This results in paths such as:
http://192.168.55.127/mywebsite/scripts/Libs/jQuery.js
http://192.168.55.127/mywebsite/pages/home.htm
which seems to be fine.
I have referenced the manifest file using the full path too:
<html manifest="http://192.168.55.127/mywebsite/manifest">
which seems to be ok, as when I load the site up in chrome and observe the developer console,