Instead of putting the script in the html element have you tried to put the script in the global html of the page? Leave only the div in the html element, publish the project and see if it works.
I’m trying to add custom HTML and javascript for Disqus, and it is not displaying either in the editor or on the published page. The code snippet is working properly in code pen. What am I missing. I tried pasting inside an “embed html” element, and also tried pasting the script portion into the global custom code box (I think). See screenshots.
In other words, how and where do I paste a custom javascript or html snippet ?
Custom HTML is where you are stepping away from the guard rails of no-code to finding out how it behaves in the code. A few thoughts that could give you momentum:
Have you published the project and looked there? “Custom code” only fires in published apps. (You can bring in custom code via HTML tags and workflows if you accept some other complexities)
I would open up devtools to start seeing where this got added into the page. Entirely possible its not where you thought it was, or maybe you see an error in the console because its missing a comma or a quotation mark. Looking a layer more deeply can help a lot.
This is also the kind of thing we do every day in our State Change office nours and loom-enabled forums. We even have an ongoing series on deep dives with devtools to help our members crack the kinds of problem you are running into. If you find this problem doesn’t respond immediately to the suggestions above (or those of others who might join this thread) you might check us out - we have hoursoffice hours sessions today and tomorrow!
Yes-- I published the project and it appears it either partially executed or not at all. (thirdy part content called by the JS was not visible when tested on one page, and garbled (possibly there, but one pixel wide) when tested on another page. Since it’s not running in the editor, I’m not great at understanding where to put it, and whether it needs to be in a certain container or section to display.
Good idea-- I had not opened or learned about devtools yet. I did open the “inspect” feature in the published version’s browser (which I’m not very familiar with), and saw several errors, which may or may not have been related.
And finally, based on some other googling, I instead pasted the code into a weweb “workflow” to run as a javascript “action” within the workflow upon pageload. This seemed to actually work in the published version-- the javascript and the third party content that it called displayed as expected.
So, at least in the hands of a noob, in Weweb, a custom javascript snippet failed to work correctly in “embed html <>” element and also in the page-level “custom code” element, but did work in the javascript “action” within a workflow. Does that sound right / expected?**
**I was pretty careful with missing commas etc., and copied/pasted the exact code snippet at each step into codepen to test.
My model for this is that the combination of no-code + AI code lets us do expert things without having to climb a slow road of expertise. Running fast to accomplish our goals in record time. But we should expect that this means stumbles - probably a lot, and some that leave bruises - along the way. If we accept that as part of the process, we can accomplish a lot.
Awesome-- not sure I understand why the result of your conversion runs but not the third-party-provided script (probably a pretty basic concept), but this sounds like just what the doctor ordered in terms of functionality (allowing testing of 3rd-party snippets within the weweb editor). Thanks so much!