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, biapar, Willr, Ingo, swaiba, simon_w

iframe get's closing tag stripped?


4 Posts   2489 Views


17 September 2010 at 9:33am Community Member, 116 Posts

- SS 2.4.0

Why does SS strip out closing iframe tags?

My page controller has a 'TextField' in the getCMSFields() function and the db array field is set as 'HTMLText.'

Note, it's not a TinyMCE issue as others have had, it's a straight text field not an HTMLEditorField.

When I paste iframe code into the field and hit "Save and Publish" the closing iframe tag is stripped out and a / is added to the opening iframe tag. This happens only if there is no space between the opening and closing tags. If I add a space, or presumably any character, the iframe tags are preserved as two separate tags.

Just wondering if this is a bug or there is some reason the system would to this by default. Is < iframe /> even a legal tag?



29 September 2010 at 4:41pm Community Member, 90 Posts

had the same problem.
trying to <iframe></iframe> Google Map.
the closing the Tag</iframe> has been trimed and to be <iframe />.

Still deosnt works..
Any suggestoin?!


29 September 2010 at 5:39pm Community Member, 470 Posts

Ya I ran into this a while back. This post in my thread has more explanations.


27 November 2010 at 8:28am Community Member, 94 Posts

I'm having this same problem, SS is automatically stripping the closing </iframe> and changing it to a self closing tag - breaking all of my page content that appears after it. Putting a space in before the closing tag works - but I don't want to have to tell my client to do this every time!

Is there a better way or can anyone suggest a solution?

My client wants to be able to embed multiple Vimeo videos onto the pages at various sizes - so he wants to control all the settings through Vimeo (rather than me hard coding the embed code onto the page). I've supplied a HTMLText box in Silverstripe for each Vimeo embed code, which works great except for this issue breaking the codes if a space isn't manually entered.

I've just realised that I should maybe have put this comment on the other thread so I'll do that also.