An Age Verification Popup (Age-Gate) in which a user must indicate that they are 21 or older to access the contents on the website. Googlebots should still be able to read the first page for SEO. If a user is under 21 they will be redirected to a popup indicating that they cannot view the content on the page. If a user is 21 or older the age-gate will be hidden on the homepage. Cookies have been used so that a return user does not have to verify if they are 21 or older. Learn more at w3schools for Cookies.
-
Google will begin to ban 3rd party cookies in 2023. Learn more straight from the source blog.google. The cookies in this project are not considered 3rd Party tracking for targeting ads.
-
Window.prompt cannot be styled using CSS so it was not used in this project.
-
Comparison Operators are a great way to take this a step further if you wish to have users enter their exact birthday or age using a form.