Age Gate with Session Cookie

Here tis, an age gate for websites that have age restrictions - i.e. alcohol brands.

It uses a session cookie to ensure that only users who have entered a suitable date of birth are able to access the main site content.

Here’s the site

Here’s the cloneable showcase

Great job… but I would be very careful using JS when it comes to things like this… such as protecting a page, age restriction etc… the reason for that if the user disables JS in their browser they still can see or access whatever. this is something I would write for server side.

Yes, I get that.

Yes but it’s a commonly accepted easy solution and the reality is that in any of these cases, it’s just a formality. What’s to stop someone from entering the wrong age so that they are “eligible” to enter?

1 Like

@Diarmuid_Sexton your are correct a user can type in any age… however depending on the situation and certain laws. if the user enters false information that is on them, but if they have the ability to skip certain requirements based on the programming or code the designer can be held responsible in the event something happens.