To configure Webflow to show a preloader only on the first visit, you can utilize a combination of Webflow's interactions and custom code to store a cookie in the user's browser. Here's how you can achieve this:
<script>
document.addEventListener("DOMContentLoaded", function() {
var hasVisited = document.cookie.split(';').some(item => item.trim().startsWith('visited='));
var preloader = document.querySelector('#your-preloader-id'); // Replace with your preloader ID or class
if (!hasVisited) {
document.cookie = "visited=true; max-age=31536000"; // 1 year
// Keep preloader visible or initial animation
} else if (preloader) {
preloader.style.display = 'none';
}
});
</script>#your-preloader-id with the actual ID or class of your preloader element.
To have a Webflow preloader appear only on the first visit, design the preloader, create load interactions, and use custom JavaScript code to check and set a cookie. This way, the preloader will only be visible to users who have not yet visited your site, enhancing the user experience.