How can I include JavaScript in a content area that doesn't overwrite itself?
Let's say I go into HTML view on a content area. It reads:
Then I add:
When I now return to editing the page, my JavaScript will actually overwrite the original 'Hello world' permanently, rather than dynamically on every page load. Obviously this extends to more complex scenarios, such as the embedding of Flash videos.
When dynamic JavaScript runs, its result gets burned into the Edicy content area, which then autosaves, making the change static!
This is as much a question as a problem report. Perhaps you could either not run any JavaScript entered into a content area's HTML when in edit mode, or filter a 'bogus' property, e.g.
<div id="foo">Hello world</div>
Then I add:
<script type="text/javascript">
document.getElementById('foo').innerText = 'Goodbye world';
</script>
When I now return to editing the page, my JavaScript will actually overwrite the original 'Hello world' permanently, rather than dynamically on every page load. Obviously this extends to more complex scenarios, such as the embedding of Flash videos.
When dynamic JavaScript runs, its result gets burned into the Edicy content area, which then autosaves, making the change static!
This is as much a question as a problem report. Perhaps you could either not run any JavaScript entered into a content area's HTML when in edit mode, or filter a 'bogus' property, e.g.
<script type="text/javascript" unless="editmode">
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?This is an interesting issue, that currently can be resolved by a workaround - adding the dynamic field into the customized page template (either your own one, or based off one of the default designs), and embedding the script. We shall definitely consider making embedding javascript easier, but this will take some time, as there are many point, that have to be considered before an optimal solution can be found.
Thank you for your feedback and this idea, hope to hear more from you.
I’m thankful
-
Inappropriate?Yes - I've been using your workaround. But it's INCREDIBLY clunky! It makes it virtually impossible (or unbearably ugly) to use impromptu JavaScript anywhere on Edicy.
As JavaScript has to be entered via the "Edit HTML" mode, you have a step available where you could filter off the JavaScript. If it didn't run in editmode, but only on the actual site, 99% of problems would be fixed.
The best solution might be this "elements" feature. If it works how I imagine (predefining bits of code that can be inserted into content areas) then the JavaScript can get wrapped up in the element; but you'd still have to force it not to run.
I’m thoughtful
-
Inappropriate?Thank you for your ideas, we will try to implement this as soon as we work through the technical details. We will notify you when this change will be done.
Thanks for your participation, we hope your experience with Edicy will only improve over the time.
I’m thankful
Loading Profile...



EMPLOYEE