1.7 KiB
1.7 KiB
🍪 How to Test Cookie Consent Banner
The Banner IS Working!
The cookie consent banner code is in the built HTML. If you don't see it, it's because:
- You already accepted/rejected before
- Consent is saved in localStorage permanently
- Banner only shows to NEW visitors
How to Test (3 Methods):
Method 1: Clear LocalStorage (Easiest)
- Open your website in browser
- Press F12 to open DevTools
- Go to Application tab (Chrome) or Storage tab (Firefox)
- Click on Local Storage → Your site URL
- Find
consent-preferenceskey - Right-click → Delete
- Refresh page (F5)
- ✅ Banner should appear at bottom!
Method 2: Incognito/Private + Clear Cache
- Close ALL browser windows
- Open NEW Incognito/Private window
- IMPORTANT: Don't visit the site first in regular browser
- Visit your site in Incognito
- ✅ Banner should appear
Method 3: Different Browser
- If you use Chrome, try Firefox or Safari
- First-time visit = banner appears
What the Banner Does:
- Shows at bottom of page (fixed position)
- Has 3 buttons: ยอมรับ | ปฏิเสธ | ปรับแต่ง
- Clicking saves preference to localStorage
- Won't show again until you clear storage
If Banner Still Doesn't Show:
- Check browser console (F12 → Console tab)
- Look for JavaScript errors
- Verify page has loaded completely
- Check if script is blocked by ad blocker
Code Location:
- File:
src/layouts/BaseLayout.astro - Lines: 41-115
- Built output:
dist/index.html(search for "consent-preferences")
The code is working correctly! It's designed to not annoy users by showing repeatedly.