Reject Cookies - クッキーを自動で拒否または閉じるChrome拡張
(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; };
まだコメントはありません。