Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

How can I add an age verification popup?


leadthepack

Question

I’m creating a website for a local brewery and need to figure out how to add an age verification request that pops up when visitors come to the site for the first time. Just needs to be basic and ask “Are you 21?” If “Yes,” let them into the site, if “No,” send somewhere else.

I searched and found a bunch of JavaScript options, but I can’t figure out how to implement it, since Squarespace 6 file modification & storage is limited.

Thanks in advance!

Edited by leadthepack
Tidy, fix tags
Link to comment
  • Answers 11
  • Created
  • Last Reply

Top Posters For This Question

11 answers to this question

Recommended Posts

  • 0

I built a simple age-gate solution for Squarespace. It's available here:

https://sf.digital/squarespace-age-popup

There's a small one-off charge to use it on your site. If you need a more advanced or customised solution, we can build these too.

-Paul

Squarespace Expert & Professional Developer

Edited by paul2009
url corrected

sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi! I'm Paul, an independent Squarespace Consultant since 2007 and founder of SF Digital, building the features that Squarespace didn't include. Our mini-extensions allow you to pick dates in any format, show prices in other currencies, take orders without payment or improve your cartI value honesty, integrity, transparency and respect . Links in my posts may refer to SF Digital products or may be affiliate links.

Link to comment
  • 0

Perhaps you might want to check out IDology's, ExpectID Age product that will help keep compliance while quickly confirming someones age accurately.

On the other hand the code below will do the most basic aspect if put on the main landing pages.


<?php
session_start();
if ($_REQUEST["over21"] == 1) {
   $_SESSION["over21"] = 1;

   header("Location: " . $_REQUEST["redirect"]);
}
?>
<html>
   <head>
       <title>Verify Your Age</title>
   </head>
   <body>
       <a href="verify.php?over18=1&
redirect=<?=$redirect?>">I am over 21</a> | 
       <a href="http://www.google.com/">I am not over 21</a>
   </body>
</html>

Edited by raptor2skooled
Link to comment
  • 0

I just faced this problem myself (although I needed a verification page, not a pop-up). I couldn't find a solution that satisfied my requirements. I now this post is more than 6 months old, buy I'm leaving my answer in case anyone else needs it.

You can get my code at https://github.com/cotupha/octli

It has the javascript necessary, as well as other files that serve as example demonstraiting how to use the javascript. It is explained how to do it without activating developer mode (which was a requirement of my client).

Link to comment
  • 0

"... It is explained how to do it without activating developer mode (which was a requirement of my client)..."

For those confused, it took me a minute of confusion as well, but according to Cotupha's instructions you would still have to set up the age verification code outside of squarespace. The first two steps wouldn't be possible with squarespace hosting as-is (non developer mode).

As it stands – I don't see any solution on the boards for an age verification that isn't just a cover page.

Edited by Guest
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...