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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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

iframe get's closing tag stripped?


Go to End


4 Posts   3208 Views

Avatar
digibrains

Community Member, 130 Posts

17 September 2010 at 9:33am

- 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?

Chris.b

Avatar
SSadmin

Community Member, 90 Posts

29 September 2010 at 4:41pm

had the same problem.
trying to <iframe></iframe> Google Map.
the closing the Tag</iframe> has been trimed and to be <iframe />.
Tried
ContentNegotiator::disable();

Still deosnt works..
Any suggestoin?!

Avatar
Liam

Community Member, 470 Posts

29 September 2010 at 5:39pm

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

http://www.silverstripe.org/general-questions/show/285052?start=0#post287467

Avatar
neilcreagh

Community Member, 136 Posts

27 November 2010 at 8:28am

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.
Thanks