Maybe I’m missing something, but despite this statement:
Add code before </head> tag. Code that is entered in the box below will be applied in the <head> tag for this page and it is a way to link external resources, add meta data, and use custom styles.
When I inspect the source code, the code that I put in that box is inserted way down in the body - below the html content in fact.
What gives?
FYI, the reason that matters to me is that my app has a black background and I am frustrated with the flash of white canvas when switching pages. While this is mostly a browser issue, it is certainly not helped by not being able to inject css right at the top of the page load.
Unfortunately, the answer to that question is a bit technical and long winded, so I’ll put it at the end of this post
FYI, the reason that matters to me is that my app has a black background and I am frustrated with the flash of white canvas when switching pages.
This is a reasonable expectation to have. Unfortunately, because of how custom code is loaded at the moment, it’s not possible to do this.
That being said, we’re actually working on some changes which will get rid of full page reloads on page navigations, so you won’t see the white flash. Once we release this, all page navigations within the app will run smoothly.
Now, here’s the long winded answer that you were promised
Historically, our blocks used to be rendered on the server, which meant that when custom code ran, it had access to all the blocks.
When we were working on the “Blocks container” feature, we moved the block rendering to the client side, which means custom code could no longer see the block elements. So we had to ensure that all the blocks are ready before we run any custom code. That’s why it runs with a delay.
Further, we used to inject the custom code into the head tag, but a lot of existing apps have ill formed custom code, which tries to insert divs inside the head element. This isn’t valid, but the browser still allows this if the code is part of the initial page load. So, to ensure that least amount of existing custom code is broken, we were forced to make this decision to put all custom code in the body.
Thank you for the detailed explanation. I suppose that it is understandable but unfortunate that misuse of the feature by some led to it being disabled for all.
Two suggestions:
Change the instructions so that they accurately describe where the custom code will be inserted.
Have a setting that allows a user to set the background colors for and . The blocks do not need to be loaded before that bit of css.