Reject Cookies - ส่วนขยาย Chrome สำหรับปฏิเสธหรือปิดคุกกี้อัตโนมัติ
(blog.bymitch.com)- ส่วนขยาย Chrome ที่ปฏิเสธหรือปิด แบนเนอร์ขอความยินยอมคุกกี้ บนเว็บไซต์โดยอัตโนมัติ
- แตกต่างจากส่วนขยายแบบยอมรับอัตโนมัติทั่วไป โดยส่วนขยายนี้จะ ปฏิเสธคุกกี้ที่ไม่จำเป็นก่อน และหากไม่สำเร็จจะใช้วิธี ปิดแบนเนอร์
- ใช้วิธีตรวจจับ "ผู้ให้บริการโซลูชันขอความยินยอมคุกกี้" อย่าง Onetrust เพื่อทำให้มี ตรรกะการตรวจจับและการปฏิเสธที่ละเอียดแม่นยำ
- ส่วนขยายนี้พัฒนาด้วย เครื่องมือ Cursor AI และ Vibe coding และโค้ดเป็น โอเพนซอร์ส
โค้ดหลัก
- ตรวจจับผู้ให้บริการที่กำหนดไว้ตามลำดับ
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; };
ยังไม่มีความคิดเห็น