Programing

Firefox에서 캐싱을 끄는 방법?

lottogame 2020. 6. 21. 19:37
반응형

Firefox에서 캐싱을 끄는 방법?


개발하는 동안 최신 버전의 JavaScript 파일을 사용하려면 Firefox에서 항상 "캐시를 지우십시오".

JavaScript 파일에 대한 캐싱을 완전히 해제하는 일종의 설정 (about : config)이 있습니까? 아니면 모든 파일에 대해 그렇지 않습니까?


Firefox 주소 표시 줄에 "about : config"를 입력하고 다음을 설정하십시오.

browser.cache.disk.enable = false
browser.cache.memory.enable = false

로컬로 개발하거나 HTML5의 새로운 매니페스트 속성을 사용하는 경우 about에서 다음을 설정해야 할 수도 있습니다.

browser.cache.offline.enable = false

웹 개발자 도구 모음은 아주 쉽게에 당신이 그것을 필요로 할 때 해제를 설정 할 수 있습니다 비활성화 캐싱 옵션이 있습니다.


사용하려고 노력 해요 CTRL- F5페이지를 업데이트?


JavaScript에 대해서만 캐싱을 비활성화하는 특정 옵션이 없으므로 캐싱을 완전히 비활성화해야합니다.

FireBug 에는 네트워크 탭의 드롭 다운 메뉴에서 브라우저 캐시를 비활성화하는 옵션이 있습니다.


같은 페이지에서 캐싱을 비활성화하려면 다음과 같이하십시오 : 참고 : 작업중 인 버전은 30.0입니다.

당신은 할 수 있습니다 :

웹 개발자 도구 모음 열기 오픈 웹 개발자

캐시 비활성화를 선택하십시오.

그 후 페이지가 다시로드되고 (현재 켜져 있음) 모든 것이 다시 캐시되고 모든 furthure 요청이 매번 다시 열리고 웹 개발자가 항상 열어두고 눈을 떼지 않고 항상 켜져 있는지 확인하십시오 (확인) .


서버 측 코드로 작업하는 경우 임의의 숫자를 생성하여 다음과 같은 방식으로 src 끝에 추가 할 수 있습니다 ....

src = "yourJavascriptFile.js? randomNumber = 434534"

randomNumber는 매번 무작위로 생성됩니다.


Firefox 48 개발자 도구

도구 상자가 열려있을 때만 캐시를 해제 할 수 있습니다. 이는 웹 개발에 적합합니다.

  • F12
  • 오른쪽 상단 모서리에있는 기어 박스
  • 맨 아래로 스크롤 고급 설정
  • "캐시 비활성화 (도구 상자가 열려있을 때)"를 확인하십시오.

여기에 이미지 설명을 입력하십시오

https://stackoverflow.com/a/27397425/895245의 내용은 비슷하지만 그 이후에는 위치가 약간 변경되었습니다.


나는 고대의 질문을 부활시키고 있다는 것을 알고 있지만 오늘이 문제를 해결하고 다른 해결책을 찾고 있습니다. 테스트를 원할 때 캐싱을 토글하는 것은 실제로 허용되지 않았으며 다른 사람들이 언급했듯이 하드 새로 고침 (ctrl + shift + r)이 항상 작동하지는 않습니다.

대신, 나는 내 dev 환경에서 내 vhost.conf 파일에 .htaccess에서 수행 할 수있는 다음을 선택했습니다.

<FilesMatch "\.(js|css)$">
FileETag None
<IfModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</IfModule>
</FilesMatch>

내 개발 환경에서 이것은 js와 css가 항상 검색되도록합니다. 또한 나머지 브라우징에는 영향을 미치지 않으며 모든 브라우저에서도 작동하므로 Chrome / ie 등의 테스트도 쉽습니다.

스 니펫을 여기에서 발견하십시오. 다른 유용한 아파치 트릭도 있습니다 : http://www.askapache.com/htaccess/using-http-headers-with-htaccess.html#prevent-caching-with-htaccess

내 고객이 항상 프로덕션 환경에서 최신 버전을 볼 수 있도록 각 업데이트에 포함 된 js의 쿼리 문자열을 증가시킵니다.

jquery.somefile.js?v=0.5

이렇게하면 클라이언트의 브라우저가 새 쿼리 문자열을 볼 때 로컬 캐시를 강제로 업데이트하지만 파일이 다시 업데이트 될 때까지 새 복사본을 캐시합니다


최선의 전략은 변경 될 때마다 재설정되는 JS 파일에 고유 한 URL을 작성하도록 사이트를 설계하는 것입니다. 이렇게하면 변경 사항이 없을 때 캐싱하지만 변경이 발생하면 즉시 다시로드됩니다.

특정 환경 도구에 맞게 조정해야하지만 PHP / Apache를 사용하는 경우 다음은 최종 사용자와 사용자 모두를위한 훌륭한 솔루션입니다.

http://verens.com/archives/2008/04/09/javascript-cache-problem-solved/


CTRL- F5사용 하여 캐시를 무시하고 다시로드 할 수 있습니다 .

캐시를 사용하지 않도록 firefox에서 환경 설정을 설정할 수 있습니다

network.http.use-cache = false

js 파일에 대해 no-cache / Expires / Cache-Control 헤더를 보내도록 웹 서버를 설정할 수 있습니다.

다음은 아파치 웹 서버 입니다.


FireBug를 사용하는 경우 네트워크 탭의 드롭 다운 메뉴에 브라우저 캐시를 비활성화하는 옵션이 있습니다.

여기에 이미지 설명을 입력하십시오


게시 된 마지막 두 솔루션에는 장단점이 있지만 둘 다 IMHO의 훌륭한 솔루션입니다.

  1. You may or may not want your session ID embedded in your url like that for tighter security. But in development that shouldn't matter, but what if you forget to remove it? Also does that really work? Wouldn't you need something like a sequential number generator (hit count stored in the session, or maybe even just if 1 then 0, if 0 then 1)?

  2. Adding a session id (or whatever sequencer) means you need to remember to add it to every resource you don't want cached. On the one hand that's better because you can just include your session id with just that resource you're actively developing and testing. On the other hand, it means you have to do that and you have to remember to remove that for production.

  3. Modifying the vhost.conf or the .htaccess file does the trick nicely without the need to remember to add and remove the session id. But the downside is performance of all js and css resources will be affected, and if you have large files, that's going to slow you down.

Both seem like great, elegant solutions -- depends on your needs.


I use CTRL-SHIFT-DELETE which activates the privacy feature, allowing you to clear your cache, reset cookies, etc, all at once. You can even configure it so that it just DOES it, instead of popping up a dialog box asking you to confirm.


In higher versions of Firefox, like Nightly, there is an options named "disable cache", you can find it by clicking the gear. And that options works only in current session, which means when you close inspector and restart it, you have to check it again if you want catch disabled.


After 2 hours of browsing for various alternatives, this is something that worked for me.

My requirement was disabling caching of js and css files in my spring secured web application. But at the same time caching these files "within" a particular session.

Passing a unique id with every request is one of the advised approaches.

And this is what I did :- Instead of

<script language="javascript" src="js/home.js"></script>

I used

<script language="javascript" src="js/home.js?id=${pageContext.session.id}"></script>

Any cons to the above approach are welcome. Security Issues ?


In firefox 45, disk cache options can be set by changing the value of: browser.cache.disk.enable

The value can be set on the "about:config" page.

On http://kb.mozillazine.org/About:config_entries#Browser I found the following description for "browser.cache.disk.enable":

True (default): Use disk cache, up to capacity specified in browser.cache.disk.capacity False: Disable disk cache (same effect as setting browser.cache.disk.capacity to 0)


First of All, this can be easily done, for e.g. by PHP to force the browser to renew files based on cache date (expiration time). If you just need it for experimental needs, then try to use ctrl+shift+del to clear all cache at once inside Firefox browser. The third solution is to use many add-ons that exits for Firefox to clear cache based on time lines.

참고URL : https://stackoverflow.com/questions/289751/how-to-turn-off-caching-on-firefox

반응형