{"id":629,"date":"2023-09-07T06:41:09","date_gmt":"2023-09-07T06:41:09","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2023\/09\/07\/8343548-hostinger-website-builder-age-verification-banner\/"},"modified":"2026-03-16T12:12:02","modified_gmt":"2026-03-16T12:12:02","slug":"8343548-hostinger-website-builder-age-verification-banner","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/8343548-hostinger-website-builder-age-verification-banner\/","title":{"rendered":"Hostinger Website Builder: Age Verification Banner"},"content":{"rendered":"<p class=\"no-margin\"><b><a href=\"https:\/\/www.hostinger.com\/website-builder\" target=\"_blank\" class=\"intercom-content-link\">Hostinger Website Builder<\/a><\/b> does not include a native widget for age verification, but it can be achieved with the help of third-party tools or custom code. <\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_de3406a1da\">Method 1 &ndash; Third-Party Widgets <\/h2><p class=\"no-margin\">Create an age verification pop-up using tools available online, for instance, <b><a href=\"https:\/\/agechecker.net\/age-gate\/create\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">AgeChecker<\/a><\/b>. <\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Once you create the widget, you&rsquo;ll get its <b>integration code<\/b>.<b> <\/b>Copy and paste the code in the <b><a href=\"\/support\/6445594-website-builder-how-to-integrate-custom-code\" target=\"_blank\" class=\"intercom-content-link\">Custom code<\/a><\/b> field of your website&rsquo;s integrations settings. Save the changes, update your website, and that&rsquo;s it!<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">The widget will be visible in the preview and live versions of your website (not in the editor). <\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_1bf6fdbd62\">Method 2 &ndash; Use Custom Code<\/h2><p class=\"no-margin\">All you need to do is the following:<\/p><ol>\n<li>\n<p class=\"no-margin\"><b>Copy<\/b> the preferred <b><a href=\"#h_6d7740da4b\" target=\"_blank\" class=\"intercom-content-link\">code<\/a><\/b> given below<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><b><a href=\"#h_6ebc08b8c1\" target=\"_blank\" class=\"intercom-content-link\">Customize<\/a><\/b> the code <\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><b><a href=\"#h_bf452eaf97\" target=\"_blank\" class=\"intercom-content-link\">Paste<\/a><\/b> it to the <b>Custom code<\/b> field in your website&rsquo;s integrations settings, save the changes, and update your site<\/p>\n<\/li>\n<\/ol><h3 id=\"h_9ec6a54008\">Copy the Code<\/h3><p class=\"no-margin\">If you use <b><a href=\"#h_56dc79cf81\" target=\"_blank\" class=\"intercom-content-link\">Code 1<\/a><\/b>, the banner will remember if a particular visitor is eligible (old enough) to access the website, meaning that the banner won&rsquo;t show up again the next time the same visitor tries opening the site.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">To<b> always<\/b> show the banner, use <b><a href=\"#h_20eb3a49b4%5C\" target=\"_blank\" class=\"intercom-content-link\">Code 2<\/a><\/b>.<\/p><p class=\"no-margin\">\n<\/p><h4 id=\"h_56dc79cf81\">Code 1 (to not repeatedly show the banner for eligible users) <\/h4><pre><code>&lt;script&gt;<br>    const bannerText = 'This website contains explicit content. Are you over 20?';<br>    const confirmationButtonText = 'Yes';<br>    const declineButtonText = 'No';<br>    const mainDiv = document.createElement('div');<br>    const divForButtons = document.createElement('div');<br>    const randomText = document.createElement('p');<br>    const randomOver = document.createElement('p');<br>    const randomUnder = document.createElement('p');<br>    const blackout = document.createElement('div');<br>    let overAge = false;<br>    blackout.id = 'blackout';<br>    divForButtons.appendChild(randomOver);<br>    divForButtons.appendChild(randomUnder);<br>    mainDiv.appendChild(randomText);<br>    mainDiv.appendChild(divForButtons);<br>    randomText.innerText = bannerText;<br>    randomOver.innerText = confirmationButtonText;<br>    randomUnder.innerText = declineButtonText;<br>    randomText.id = 'ageText';<br>    randomOver.classList.add('ageButton');<br>    randomUnder.classList.add('ageButton');<br>    mainDiv.id = 'ageVerificationBanner';<br>    if (!localStorage.getItem('overAge')) {<br>        document.body.appendChild(blackout);<br>        document.body.appendChild(mainDiv);<br>        document.body.style.overflow = 'hidden';<br>    }<br>    randomOver.addEventListener('click', function () {<br>        document.body.style.overflow = 'visible';<br>        document.querySelector('#ageVerificationBanner').style.display = 'none';<br>        document.querySelector('#blackout').style.display = 'none';<br>        overAge = true;<br>        localStorage.setItem('overAge', overAge);<br>    })<br>    randomUnder.addEventListener('click', function () {<br>        window.location = 'https:\/\/google.com';<br>    })<br>&lt;\/script&gt;<br>&lt;style&gt;<br>    #blackout {<br>        background-color: rgba(0, 0, 0, 0.3);<br>        width: 100%;<br>        height: 100%;<br>        position: absolute;<br>        left: 0;<br>        top: 0;<br>        z-index: 9999;<br>    }<br>    div#ageVerificationBanner {<br>        position: absolute;<br>        z-index: 99999;<br>        transform: translate(-50%, -50%);<br>        top: 50%;<br>        left: 50%;<br>        background-color: #DADADA;<br>        padding: 50px;<br>        border: solid 2px #606060;<br>        border-radius: 10px;<br>    }<br>    div#ageVerificationBanner div {<br>        display: flex;<br>        justify-content: center;<br>    }<br>    p.ageButton {<br>        padding: 5px 10px;<br>        margin: 0 10px;<br>        cursor: pointer;<br>        background-color: #AFAFAF;<br>        border-radius: 5px;<br>        border: solid 2px #606060;<br>    }<br>    p#ageText {<br>        text-align: center;<br>        padding-bottom: 20px;<br>    }<br>    @media screen and (max-width:920px) {<br>        div#ageVerificationBanner {<br>            width: 300px;<br>            padding: 20px;<br>        }<br>        p.ageButton {<br>            font-size: 14px;<br>        }<br>    }<br>&lt;\/style&gt;<\/code><\/pre><p class=\"no-margin\">\n<\/p><h4 id=\"h_20eb3a49b4\">Code 2 (to always show the banner)<\/h4><pre><code>&lt;script data-rehype&gt;<br>    const mainDiv = document.createElement('div');<br>    const divForButtons = document.createElement('div');<br>    const randomText = document.createElement('p');<br>    const randomOver = document.createElement('p');<br>    const randomUnder = document.createElement('p');<br>    const blackout = document.createElement('div');<br>    blackout.id = 'blackout';<br>    divForButtons.appendChild(randomOver);<br>    divForButtons.appendChild(randomUnder);<br>    mainDiv.appendChild(randomText);<br>    mainDiv.appendChild(divForButtons);<br>    randomText.innerText = 'This site contains explicit content.';<br>    randomOver.innerText = 'I am over 18';<br>    randomUnder.innerText = 'I am under 18';<br>    randomText.id = 'ageText';<br>    randomOver.classList.add('ageButton');<br>    randomUnder.classList.add('ageButton');<br>    mainDiv.id = 'ageVerificationBanner';<br>    document.body.appendChild(blackout);<br>    document.body.appendChild(mainDiv);<br>    document.body.style.overflow = 'hidden';<br>    randomOver.addEventListener('click', function () {<br>        document.body.style.overflow = 'visible';<br>        document.querySelector('#ageVerificationBanner').style.display = 'none';<br>        document.querySelector('#blackout').style.display = 'none';<br>    })<br>    randomUnder.addEventListener('click', function () {<br>        window.location = 'https:\/\/google.com';<br>    })<br>&lt;\/script&gt;<br>&lt;style&gt;<br>    #blackout {<br>        background-color: rgba(0, 0, 0, 0.3);<br>        width: 100%;<br>        height: 100%;<br>        position: absolute;<br>        left: 0;<br>        top: 0;<br>        z-index: 9999;<br>    }<br>    div#ageVerificationBanner {<br>        position: absolute;<br>        z-index: 99999;<br>        transform: translate(-50%, -50%);<br>        top: 50%;<br>        left: 50%;<br>        background-color: #DADADA;<br>        padding: 50px;<br>        border: solid 2px #606060;<br>        border-radius: 10px;<br>    }<br>    div#ageVerificationBanner div {<br>        display: flex;<br>        justify-content: center;<br>    }<br>    p.ageButton {<br>        padding: 5px 10px;<br>        margin: 0 10px;<br>        cursor: pointer;<br>        background-color: #AFAFAF;<br>        border-radius: 5px;<br>        border: solid 2px #606060;<br>    }<br>    p#ageText {<br>        text-align: center;<br>        padding-bottom: 20px;<br>    }<br><br>    @media screen and (max-width:920px) {<br>        div#ageVerificationBanner {<br>            width: 300px;<br>            padding: 20px;<br>        }<br>        p.ageButton {<br>            font-size: 14px;<br>        }<br>    }<br>&lt;\/style&gt;<\/code><\/pre><p class=\"no-margin\">\n<\/p><h3 id=\"h_989fb57812\">Customize the Code<\/h3><p class=\"no-margin\">The text for the banner can be changed in these lines:<\/p><pre><code>   const bannerText = 'This website contains explicit content. Are you over 20?';<br>    const confirmationButtonText = 'Yes';<br>    const declineButtonText = 'No';<\/code><\/pre><p class=\"no-margin\">If you know <b><a href=\"https:\/\/www.w3schools.com\/css\/\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">CSS<\/a><\/b>, you may also change the banner appearance, e.g., font size, colors, etc.<\/p><p class=\"no-margin\">\n<\/p><h3 id=\"h_51890f42cf\">Paste the Code<\/h3><p class=\"no-margin\">Within the builder, go to your website&rsquo;s <b>Settings<\/b> &rarr; <b>Integrations<\/b>, and paste the code in the <b><a href=\"\/support\/6445594-website-builder-how-to-add-custom-code-to-the-head-head-part-of-a-website-s-code\" target=\"_blank\" class=\"intercom-content-link\">Custom code<\/a><\/b> field. Then, <b>save the changes<\/b> and <b>update your website<\/b>.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">The banner shows up in the preview mode and online; it&rsquo;s not visible in the editor.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to add a banner for age verification to your website created with Hostinger Website Builder<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[284],"tags":[],"class_list":["post-629","post","type-post","status-publish","format-standard","hentry","category-integrations"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/8343548-hostinger-website-builder-age-verification-banner\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/8343548-hostinger-creador-de-sitios-web-banner-de-verificacion-de-edad\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/629","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=629"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/629\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}