Site URL: https://rose-bellflower-zcdd.squarespace.com/config/settings/advanced/code-injection
Hello there!
I am facing a problem with including a file badge code for another website, the code is as follows:
<script type="text/javascript" id="ngos-ed-on-file-widget-script-17336c1f-917d-492b-bc53-225c95e103da">
(function() {
function async_load()
{ var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; var theUrl = 'http://www.ngosource.org/sites/default/files/ngos_ed_on_file_widget.js'; s.src = theUrl + ( theUrl.indexOf("?") >= 0 ? "&" : "?") + 'ref=' + encodeURIComponent(window.location.href); var embedder = document.getElementById('ngos-ed-on-file-widget-script-17336c1f-917d-492b-bc53-225c95e103da'); embedder.parentNode.insertBefore(s, embedder); }
if (window.attachEvent)
window.attachEvent('onload', async_load);
else
window.addEventListener('load', async_load, false);
})();
</script>
When I uploaded this code on the code-injection tool on my website it showed me a syntax error- so I followed the instructions below:
To add JavaScript to a code injection field, surround the code with <script></script> tags.
And it kind of worked- as in it appeared on the website but in a text form- see picture for reference.
Could you please help as to how to solve this issue? Also, if I'd want this code to appear in like the middle of the page instead of the footer how can I do it?
Thanks!