Webflow Editor not working - due to custom cookies code?

Please help!

We are unable to access the editor for the Home Page of our site. The other pages are working fine. We have some custom code on the home page that allows the user to close a banner and not see it again until the next day. I’ve included the code snippet below and also a screenshot of what it looks like when we try to open the editor.

I have tried several different browsers.
After removing the code the editor works but we really need the banner to not pop up every time a user revisits the page. Is there a way to do this without affecting the editor?

Here is a read-only link to our site

<style>
/*The page-wrapper is initially hidden*/
.page-wrapper {
  display:none;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.0/js.cookie.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function(event) { 
  // get a reference to the page wrapper
  const pageWrapper = document.querySelector(".page-wrapper");
  // get a reference to the loading wrapper
  const loadingWrapper = document.querySelector('.popia-banner_component');

  // get the 'seenAnimation' cookie and store in a seenAnimation variable
  const seenAnimation = Cookies.get('seenAnimation');
  // if the 'seenAnimation' cookie is undefined
  if(!seenAnimation){
    // display the loading-wrapper 
    loadingWrapper.style.display = "flex";
    // show the page-wrapper 
    // after a set duration of 3000 milliseconds
    // (the time it takes to show the loading-wrapper in this case)
    setTimeout(()=>{
      pageWrapper.style.display = "block";
    }, 1000);
    // set the 'seenAnimation' cookie 
    Cookies.set('seenAnimation', 1, { expires: 1 });
  }
  else{
    // else if the 'seenAnimation' cookie exists
    // the user has already seen the animation
    // and so
    // hide the loading-wrapper
    loadingWrapper.style.visibility = "hidden";
    // show the page-wrapper 
    pageWrapper.style.display = "block";
}

});
</script>

Hi there. What exactly is happening when you try to access the editor from the home page of the site? I visited https://orgsamro.webflow.io?edit and was able to get the editor login form to appear, which is a good sign.

edit: Ah, I just noticed your screenshot of the editor. So you can log into editor mode at least, it’s just not loading the page content. Let me look further into this. I’ve had javascript libraries interfere with the editor in the past.

Hi Carly, thank you so much!

Will keep an eye out for your response :pray:

Could you try moving your code from before the closing body up into the head instead?

It was in the head previously, I moved it to the closing body today, to see if that would fix the issue, It made no difference

Any update?

I have an issue with cookie-script where we embedded the code at very first in the header. Unfortunately we can’t access the editor, until we remove the copy-script embed code…