Age Gate (Verification) Using Modal Bric

Hi All

Thought I would share with the community for those who need to implement a age checker when someone enters their website.

In this case I have placed a Modal Bric into the global header and styled it as required. On all pages input the following javascript
Screenshot 2020-04-14 at 14.41.47

In this instance the cookie lasts for 10 minutes so no matter what page the user enters the website they will only be asked to confirm their age the once.

Note: the code will only run when it is uploaded to server, it will not run in preview mode

Tested and fully working at


I have clicked out the modal and it disappeared letting me navigate through the site, refreshed and did not show up again. It also takes a while to load, maybe you could improve your images size

As @chicuelo pointed out this basic approach can easily be bypassed through various ways by simply doing any of the following for example:

  • Revisit page (leave & come back) without declaring age
  • Reload page, without declaring age
  • Choose “I am under 18”, get redirected, click back button
  • etc.,

So @steviemc you may wish to rethink your approach as its not very effective for its intended purpose.

Added .modal({backdrop: ‘static’,keyboard: false, show:true}) to the code to prevent click outside the box etc. I’ll admit its not the best but it does what its intended to do and just give a warning before someone enters the site. For a none coder and picking up snippets of code I think it works ok and doesn’t have other peoples brand names on it which is what you get with the free alternatives that are out there. Paid ones for credit card verification cost money. Until someone comes up with one for the which is bullet proof then this will do for me. Used Free Image Convertor from the Mac App store which also compresses images quite well without adding additional metadata to the image. Load time on page differences on home page are cached 4s uncached 3s.

For those wishing to use it here’s the full code
Screenshot 2020-07-01 at 09.42.59

Note I’ve changed website address to if anybody wants to see it working.

1 Like