- Extensions - Chrome Developers1
- Migrating to Manifest V3 - Chrome Developers2
- Migrating from background pages to service workers - Chrome Developers3
- WebExtensions - Mozilla | MDN4
- Helpful Tips for Starting a Next.js Chrome Extension | CSS-Tricks - CSS-Tricks5
- chrome.runtime
- WXT
- Work with the Cookies API - Mozilla | MDN
- cookies - Mozilla | MDN
- Internationalization - Mozilla | MDN
- Internationalize your extension - Chrome Developers
Footnotes
httpOnly, secure 플래그 쿠키값이 필요한 경우 브라우저 쿠키 저장소에서 꺼낸다. HttpOnly 는 페이지의 JS(document.cookie)에서만 가려질 뿐 브라우저 쿠키 저장소에는 있다.1 Puppeteer 25 기준 browser.cookies() 가 그 저장소를 읽는다.2
const cookies = await browser.cookies() // HttpOnly 쿠키도 httpOnly: true 로 들어 있다
로컬에 해당 쿠키정보를 임시로 저장해서 재활용하고 만료 시 갱신하는 방법을 사용.
fs.writeFileSync('cookies.json', JSON.stringify(cookies))
await browser.setCookie(...JSON.parse(fs.readFileSync('cookies.json', 'utf8')))
예전 방식(CDP Network.getAllCookies, page.setCookie)은 둘 다 폐기됐다.3
Footnotes
-
Set-Cookie - MDN: “Forbids JavaScript from accessing the cookie, for example, through the Document.cookie property.” ↩
-
Chrome DevTools Protocol — Network.getAllCookies: “Deprecated. Use Storage.getCookies instead.” · Page.setCookie() — Puppeteer: “Page-level cookie API is deprecated. Use Browser.setCookie() or BrowserContext.setCookie() instead.” ↩