Hi everyone.
I have a copyright auto-year small script I got from this community many years ago. Has been working fine, but just now isn’t.
The script (below) has always been in the Site Settings area (before /body>) and that hasn’t changed.
The HTML date part {year} is span-wrapped and style linked as it’s always been.
Not certain why these constructions worked before, as they probably shouldn’t have, and probably didn’t on slower networks - but something’s changed to make them consistently fail.
In essence you need to wait for the Webflow object to exist before your code executes. This is the accepted approach;
<script>
var Webflow = Webflow || [];
Webflow.push(function() {
// your code here
});
</script>
I had the same problem earlier dunno if Weblow had some updates that creates bug or new instructions how to use it but what i did was to use vanilla JS to execute the same function in your case you can use:
<script>
document.addEventListener('DOMContentLoaded', function() {
document.querySelector('.copyright-year').textContent = new Date().getFullYear();
});
</script>