Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Script doesn't stay in editor

Go to End

7 Posts   2009 Views


Community Member, 182 Posts

7 July 2009 at 7:43am

I have the following script:

<div id="heyzap_games_medium" style=""></div>
<script type="text/javascript" src=""> </script>
<style> @import ''; </style>
<script type="text/javascript">
  var heyzap_medium = new Heyzap( 'heyzap_games_medium', {"embed_key":"8840962768"} );
  heyzap_medium.renderMini( null, 'medium' );
<a target="_blank" href=""> - embed games</a>

Why doesn't this kept saved in the wysiwyg editor? I put it in there in HTML mode. For other embedded scripts there is no problem. Only for this one


Community Member, 607 Posts

7 July 2009 at 12:34pm

Edited: 07/07/2009 12:34pm

The WYSIWYG editor strips many normal HTML tags as a security precaution.

What is different about this snippet from the others that have been successfully saved? I'm picking that it's the javascript or the @import statement.



Community Member, 182 Posts

7 July 2009 at 9:28pm

Yes that could be it.

How can i solve this easily?

Add an extra field in a Page page with only html ?


Community Member, 181 Posts

8 July 2009 at 2:12pm

The TinyMCE (the WYSIWYG editor) config has changed a fair bit between SS versions, which version of SS are you working with?

Also, how are you using these other scripts that work? as far as I can see (in v2.3.2 at least) the script tag is not allowed and will get stripped out. same goes for style.

TinyMCE can be configured to allow additional tags and attributes, how you do this depends on the version of SS you are running.




Community Member, 607 Posts

8 July 2009 at 2:27pm

Edited: 08/07/2009 2:28pm

This is a TinyMCE config thing, not SS related.

Check this out for guidance:

There are also a few posts in the archive forum on this, do a search through that. Here's one that I remember:



Community Member, 182 Posts

8 July 2009 at 8:46pm

Edited: 08/07/2009 8:48pm


I found the solution in this topic:

Just take out all the elements lol :D


Community Member, 2 Posts

29 September 2009 at 5:10am

this does not work in my version of SS. (ver 2.3.3)

there is not file named /cms/javascript/tinymce.template.js
i did find an entry for valid_elements but it was already something like "*

  • "

    and I cannot add a <script> tag, so here is what i did.

    I did find an entry in /cms/code/LeftAndMain.php for valid_elements

    and added ",script[src|type]" to the long list of valid_elements and then did the ?flush=1 thing and it seemed to work.

    hope that helps someone else.