HTML5 Application Cache

참고자료

http://en.wikipedia.org/wiki/Cache_manifest_in_HTML5

http://xguru.net/621

http://blog.naver.com/hihihichoi?Redirect=Log&logNo=20141414906


2012.04.05 링크수정 추가


추가 참고자료

http://stackoverflow.com/questions/3281827/html5-cache-manifest-fallback-section-network

http://b.mytears.org/2010/09/2272

http://html5doctor.com/go-offline-with-application-cache/


기본적인 사용방법

html 파일

<html manifest="appcache.cache">

- appcache.cache 라는 캐시 설정파일로 설정한다.


appcache.cache

CACHE MANIFEST
# 주석
# 2012.04.05 : v1

CACHE:
main.css
FALLBACK:
/ /offline.html
NETWORK:
*

- .cache라는 파일은 서버 mine-type이 text/cache-manifest로 지정되어야 한다.


manifest 기본적인 구조는

CACHE MANIFEST - 헤더

CACHE: - 캐시 파일들

FALLBACK: - 오프라인일 경우 대체되는 파일들

NETWORK: - 캐시되지 않고 항상 다운로드되는 파일들



팁. 서버 설정을 바꾸지 않고 사용하기

JSP - cache.jsp

<%

    response.setContentType("text/cache-manifest;charset=UTF-8");

    response.setHeader("cache-control", "no-cache");

    response.setHeader("expires", "0");

    response.setHeader("pragma", "no-cache");

%>


ASP - cache.asp

<% response.ContentType ="text/cache-manifest" %> 


PHP - cache.php

<%@ page contentType="text/cache-manifest;charset=UTF-8"%>



Posted by Mooki
,