Try our conversational search powered by Generative AI!

Scripts in html blocks

Vote:
 

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?

Thanks,

Tim

#143153
Jan 13, 2016 15:50
Vote:
 

Hi,

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.

#143160
Jan 13, 2016 22:27
Vote:
 

Hi Johan,

Thanks for replying. Eeek. I'm not too sure if it's an XhtmlString property. I read http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/7/Content/Properties/Properties/ but it's far too technical for me, as too is making a plugin unfortunately looking at this http://archive.tinymce.com/wiki.php/Tutorials:Creating_a_plugin.

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.

Thanks,

Tim

#143184
Jan 14, 2016 11:39
Vote:
 

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 http://krompaco.nu/2010/05/alter-default-initoptions-for-tinymce-in-episerver-6/, this works in latest version too.

#143186
Edited, Jan 14, 2016 12:38
Vote:
 

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! 

#143191
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.