[TIL] 220510

슬지로운 개발생활·2022년 6월 20일
0

TIL

목록 보기
69/73

1. 언더스코어( _ )

2. Private class fields( # )

https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Classes/Private_class_fields

3. 이미지 캐시

  • 이미지를 변경했는데, 앞단에서 이미지가 바로 변경이 안되는 경우는 이미지가 캐시되어있어서 그렇다.
    • Method1: html문서 header에 특정값을 추가해서 처리하는 방법
      <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
      <meta http-equiv="Pragma" content="no-cache">
      <meta http-equiv="Expires" content="0">
    • Method2: image src에 특정값(날짜)을 추가해줌으로써 웹브라우저에게 캐슁된 이미지를 계속 사용하지말고 서버에 계속 물어보게끔 처리하는 방법이 있다.
      const imgSrc = `${imgUrl}?x=${Date.now()}`

참고:

0개의 댓글