Footnotes

  1. 새롭게 문서사이트가 개편되면서 현실적인 도움이 된다. ↩

  2. v3로 이전하기 위한 대략적인 가이드. 직접 옮겨보니 host_permissions으로 분리, action으로 통합(두군데 수정이 필요하다) — webext 커밋 ↩

  3. service_worker로 변경되면서 추가적으로 가이드 문서가 새로 생겼다. ↩

  4. mdn 스타일이 좋다면 이쪽 문서도 괜찮다. ↩

  5. next 구성으로 익스텐션 만들기 ↩

#127
# 크롬 익스텐션이 설치되는 경로는 다음과 같다
/Users/USERNAME/Library/Application Support/Google/Chrome/Default/Extensions

웹 페이지가 확장 리소스를 읽을 수 있는 건 web_accessible_resources 에 선언된 것뿐이다.1

function isInstalled(extensionId) {
  return new Promise((resolve, reject) => {
    const img = new Image()

    img.src = `chrome-extension://${extensionId}/icon-128.png` // 해당 리소스가 `web_accessible_resources`에 선언되어 있는지 확인이 필요하다.
    img.onload = () => {
      resolve(true)
    }
    img.onerror = () => {
      reject()
    }
  })
}

Footnotes

  1. Manifest - Web Accessible Resources - Chrome for Developers: “By default no resources are web accessible, as this allows a malicious website to fingerprint extensions that a user has installed…” ↩

#207