风言枫语  
 1、环境搭建(Tomcat为例):

               在Tomcat中的conf配置文件中web.xml中添加离线配置:

<!--HTML5-->
	<mime-mapping>
		<extension>appcache</extension>
		<mime-type>text/cache-manifest</mime-type>
	</mime-mapping>
<!--HTML5-->




2、web项目中创建index.appcache在其录入一下内容:

CACHE MANIFEST
CACHE:
index.jsp
test.htm

3、创建HTML5页面

注意:要想其离线应用功能启用,在HTML5中添加如下内容:

<html manifest="index.appcache">

4、页面如下内容:

<!DOCTYPE html>
<html manifest="index.appcache">
  <head>
   <meta charset="UTF-8">
   <title>HTML5特性之离线缓存测试</title>
  </head>
  <body>+++++++++++++++++++++++++++++++++++++++
  </body>
</html>
5、测试:启动tomcat访问后,关闭tomcat,再次访问,即可看到效果



 


 

            

 

posted on 2013-09-10 19:57  风言枫语  阅读(385)  评论(0编辑  收藏  举报