English 中文(简体)
从缓存中脱机可用的网络应用程序
原标题:Web application available offline from cache

我需要在离线支持下创建一个网络应用程序。 当客户端的计算机脱线时, Javascript 必须重定向到另一个页面, 从应用程序中获取重要信息 。

重定向到离线网页

window.addEventListener("offline", function(e) {
   document.location.href= /offline/index.html ;
}
, false);

如何强制在浏览器缓存中保存 /offline/index.html 页面, 以确保当互联网连接中断时内容可用?

/offline/index.html 页面将每10分钟更新一次(如果应用程序在线),缓存必须保持更新。

-- -- -- -- --

我试图在主应用程序 s html 中使用缓存列表, 但是这没有正确运行 。 离线页面已被保存, 但在线模式中的其他页面也被保存 。 我只需要缓存一个文件, < code> offline/ index. html , 我更愿意手动重定向到离线页面上, 没有 HTML5 脱线解决方案的 Javascript 事件 。

我的缓存清单文件 :

CACHE MANIFEST

/ff/landing/js/jquery.min.js
/ff/default/js/online.js

FALLBACK:
/ /offline/index.html

NETWORK:
*
问题回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签