Aug 15
JS In Body
Would be nice if there was a way to inject JS at the bottom of the body on all pages. Injection into the header works, but for some uses cases I have to write scripts that wait for the body to load and defer them so that I can ensure they don’t fire until after the body is done. This leads to a tiny bit of weirdness, but if there was a way to inject JS into the bottom of every page it would make things a bit simpler.
Completed
That’s a good idea and definitely something we can add. In the meantime you can still direct scripts to execute when the body is loaded, regardless of where your javascript is rendered. Until we add this feature, you can use the following code to execute your script once the body has been processed by the browser without waiting for images to load. If you want to avoid for everything to be loaded you can use the `load` event instead of `DOMContentLoaded`. <script> document.addEventListener("DOMContentLoaded", (event) => { // your code here console.log("DOM fully loaded and parsed"); }); </script>