我了解html5中具有静态内容和普通文件扩展名的应用程序缓存,例如: index.html、theme.css、app.js
问题是如何使用MVC4为web应用程序缓存它??数据是动态的,其中来自api和set-to localStorage。
我想缓存应用程序模板( *.cshtml )的文件脱机使用。
CACHE MANIFEST
# 2012-02-21 v1.0.0
CACHE
/theme.css *<-- Understand*
/logo.gif
/main.js
/home/index.cshtml *<-- is this correct?*
/sales/dashboard.cshtml *<-- is this correct?*
/_Answer_below *<-- please help this
NETWORK:
/config.html
FALLBACK:
/html/ /offline.html
example.com/home
路由至
=> A)。example.com/home/index.cshtml
或B)。example.com/home/index.html
或C)。example.com/home/index
发布于 2014-01-01 19:00:41
应用程序缓存应该指定客户端URI,因此B或C上的URI有效,这取决于您在mvc应用程序中设置路由的方式
CACHE
/theme.css *<-- Understand*
/logo.gif
/main.js
/home/index
/sales/dashboard
cshtml文件是服务器端模板,在服务器上重新生成,因此没有理由在客户端缓存它们。反面的渲染视图是您要缓存的视图
另一种方法是使用一些客户端mvc框架,如knockout,angular等,或者只是使用一些handlebars模板和缓存库,而不是渲染视图,以及一些数据
https://stackoverflow.com/questions/20872066
复制