A user, gar1t, is trying to access the API from a custom component using a script in the HTML body, but the script is not appearing in the page HTML. Arkshine suggests moving the code to the theme component’s Head tab, which allows the script to run and output to the browser console. gar1t confirms this solution, noting that Discourse removes API snippets from the body section, while retaining other script elements.
Thank you. I had placed this code in the body section.
It’s surprising to me that the head behavior here is different. It looks like Discourse is removing these api snippets from the body section. Other script elements are retained there.