Try our conversational search powered by Generative AI!

Scripts in html blocks


Hi all,

I'm having trouble implementing a widget into an HTML block.

When I publish it, it's stripped down to:

Any ideas? Do I need to contain it in something additional?



Jan 13, 2016 15:50


In what kind of property are you putting this code? If it's inside an XhtmlString property it might get "cleaned-up" by the editor TinyMCE. Then you might have to create a TinyMCE plugin and change the settings to allow additional attributes on div elements. Maybe TinyMCE strips empty div elements as well.

Jan 13, 2016 22:27

Hi Johan,

Thanks for replying. Eeek. I'm not too sure if it's an XhtmlString property. I read but it's far too technical for me, as too is making a plugin unfortunately looking at this

It sounds very similar to Wordpress in terms of the editor 'cleaning' the code, but I can use an iFrame at least. It appears iFrames in EPiserver HTML blocks don't work either.



Jan 14, 2016 11:39

If you can format the text, i.e. create links and headings, then it's an XhtmlString. Iframes are also probably stripped away.

Not sure what you can change from web.config, but you need to change the valid elements (and attributes) to allow iframes, empty divs and additional attributes. If you can't change the setting from web.config you need to create a plugin, please see, this works in latest version too.

Edited, Jan 14, 2016 12:38

Thanks Johan. Ah yes it's an XhtmlString.

I'll need to ask a developer about changing settings in web.config. Thanks for your help Johan! 

Jan 14, 2016 13:10
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.