Css 캐싱 방지 » 이력 » 버전 1
김 미진, 2025/04/22 10:30
1 | 1 | 김 미진 | h1. Css 캐싱 방지 |
---|---|---|---|
2 | |||
3 | css파일을 수정해도 사용자가 캐시 삭제를 하지 않으면 |
||
4 | 반영되지 않기 때문에 css파일을 강제로 재로딩 시켜줘야함. |
||
5 | |||
6 | 방법1. 이미지1 참조 |
||
7 | <pre> |
||
8 | var link = '<link rel = "stylesheet" type = "text/css" href = "/webroot/scripts/widget.css?${=timestamp}">'; |
||
9 | $("head"). append (link); |
||
10 | </pre> |
||
11 | |||
12 | 방법2. 이미지2참조 |
||
13 | <pre> |
||
14 | $('<link rel = "stylesheet" type = "text/css"href = "/webroot/scripts/widget.css?${=timestamp}"/>').appendTo('head'); |
||
15 | </pre> |
||
16 | |||
17 | 방법3. 첨부파일 nocache.js와 이미지3참조 |
||
18 | <pre> |
||
19 | getFetchVersion('/webroot/scripts/widget.css'); |
||
20 | </pre> |