I've been working on a custom page in Sitecore over the holidays, and I've noticed an issue where Sitecore removes JavaScript lines from the editor.
Here's an overview of my current scenario:
I'm the only one who's edited this page, and it is publishing the current/correct version. It doesn't matter if I add the script through the "Show Editor" or "Edit HTML" features of the content editor. It only removes the JavaScript though; all of my other changes are intact.
Is there something that I'm missing about Sitecore's implementation of JavaScript? I'm not sure what else to do in order to diagnose it, so I was hoping someone here would have an explanation for this.
Removing the script-tags in the RTE in Sitecore is standard behavior when the item is saved. However, in Sitecore 6.4.1 rev. 120113 and Sitecore 6.5 Update-4 there is a new property added in the web.config:
<setting name="HtmlEditor.RemoveScripts" value="true"/>
Setting this value to false should solve your problem. If you are using an older version of Sitecore, take a look at this blogpost which shows a workaround for older versions.
Are you adding this javascript in a Rich Text Editor?
I've seen the rich text editor strip out javascript as it saves. We have typically added javascript blocks in as a separate sublayout pulling from a multi-line text field and having it render out directly, rather than editing javascript through the rich text editor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With