Reject Cookies - 쿠키를 자동 거부하거나 닫아주는 크롬 확장
(blog.bymitch.com)- 웹사이트의 쿠키 동의 배너를 자동으로 거부하거나 닫아주는 Chrome 확장 프로그램
- 기존의 자동 수락 확장과 달리, 이 확장은 비필수 쿠키를 우선 거부하고, 실패 시 배너를 닫는 방식을 채택
- Onetrust 같은 "쿠키 동의 솔루션 벤더"를 탐지하는 방식으로 정교한 탐지 및 거부 로직을 구현
- 확장은 Cursor AI 도구와 Vibe 코딩으로 개발되었으며, 코드는 오픈소스
주요 코드
- 지정된 벤더 탐지를 순차적으로 수행
const findAndClickRejectButtons = () => { commonCookiePopupChecks.forEach(({ check, rejectOrClose }) => { if (check()) { rejectOrClose(); return; } }); }
- 특정 벤더 찾기: OneTrust
const checkForOneTrust = (): boolean => !!document.getElementById('onetrust-consent-sdk'); const closeOrRejectOneTrust = () => { const rejectButton = document.getElementById('onetrust-reject-all-handler'); if (rejectButton) { rejectButton.click(); return true; } const consentSDK = document.getElementById('onetrust-consent-sdk'); if (consentSDK) { consentSDK.remove(); return true; } return false; };