Jump to content

iframes are being stripped from CKEditor field, even when explicitly allowed


wes
 Share

Recommended Posts

Having some issue with getting an iframe to save on a CKeditor text field (2.5.3). Things I've done to explicity allow it:

- added "iframe[*]" to extraAllowedContent

- added "IFrame" to the CKEditor toolbar

- turned off CKEditor ACF

- switched the field's "Content Type" from "Markup/HTML" to "Unknown" 

When pasting in my iframe code (it's a Vimeo embed code), CKEditor shows the iframe placeholder, but after saving the page, it's stripped out. For testing, I tried adding a simpler iframe using CKEditor's iframe toolbar button, but that also gets stripped out after saving.

Anyone experiencing this, or have iframes working with their field?

Link to comment
Share on other sites

It is definitely possible to allow iframes through CKEditor with the right settings, but I would suggest that the easiest option might be to set up a Hanna Code (http://modules.processwire.com/modules/process-hanna-code/) tag for inserting iframes. I have to head out, but hopefully someone else can give you an example if you can't figure it out.

Link to comment
Share on other sites

Here's how it worked for me in CKEditor (in case you persist on this route :-) - but I would go for Hanna Code as Adrian suggested. As usual, the "culprit" is our friend HTML Purifier (read from here up to and including Ryan's comment here about its pros and cons before deciding whether to implement #5 below!) 

  • For iframes, the Extra allowed content seems to have no effect - btw, the correct syntax here is for example, div(*) not div[*]
  • Add 'Iframe' (note the spelling) to your CKEditor Toolbar
  • Leave ACF on
  • No need to switch the field's "Content Type" from "Markup/HTML" to "Unknown" 
  • Turn HTML Purifier off (gasp! :undecided:  :-X  :-) )
  • Enjoy your embedded video :D
  • Like 12
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...