To create a cookie consent modal in Webflow that appears only once on the first page load, you can't use Webflow's native features alone. However, you can utilize custom code and Webflow's interactions to achieve this goal without third-party tools.
Example inline JavaScript (insert in <head> or before </body> in Custom Code):
document.addEventListener('DOMContentLoaded', function() {
if (!document.cookie.includes('cookieConsentGiven=true')) {
document.querySelector('#yourModalId').style.display = 'block';
document.querySelector('#acceptButton').addEventListener('click', function() {
document.cookie = "cookieConsentGiven=true; path=/";
document.querySelector('#yourModalId').style.display = 'none';
});
}
});
#yourModalId with the actual ID of your modal and #acceptButton with the ID of your consent button.
You can achieve a one-time cookie consent modal in Webflow using a combination of Webflow interactions and custom JavaScript to set and check cookies. This method allows you to comply with European regulations without involving third-party tools. Make sure to test thoroughly across different browsers.