2

I've updated my craft/config/redactor/UserContent.json settings with allowedTags containing iframe but iframe tags are stripped on save.

Other added allowedTags seem fine and iframe works on paste and initial editing, just not after saving.

Running Craft Pro 2.4.2679

I see there were issues with this for older versions of Redactor but they seem to be resolved. Any ideas about how to fix this?

Here's my UserContent.json:

{
    toolbarFixed: true,
    buttons: ['html', 'formatting', 'bold', 'italic', 'underline', 'deleted', 'horizontalrule',
              'unorderedlist', 'orderedlist', 'alignment', 'indent', 'outdent',
              'link', 'image', 'video', 'table'],
    removeEmpty: ['p','strong','em','span','a'],
    cleanStyleOnEnter: true,
    plugins: ['video', 'table'],
    allowedTags: ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'blockquote', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'map', 'mark', 'menu', 'nav', 'ol', 'optgroup', 'option', 'p', 'picture', 'pre', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'small', 'source', 'span', 'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr'],
}
5
  • Have you tried unchecking both "Clean up HTML?" and "Purify HTML?" in the rich text field's settings?
    – Brad Bell
    Sep 22, 2015 at 22:35
  • Yes, they are both unchecked. The rich text field is in a matrix field, if that matters in any way. Sep 23, 2015 at 13:14
  • And you're sure that the RTE field you're testing with is using your custom redactor .json file in its field settings?
    – Brad Bell
    Sep 23, 2015 at 18:57
  • Yes. I checked the field settings again just now. I've tested with a variety of tags and they are all fine. I've edited my question to show the whole UserContent.json. Note that I also tried it without 'allowedTags' and get the same results, including after clearing Craft caches. It just doesn't like iframes - try it and if you find differently, please let me know. I have tested with YouTube iframes and another iframe with plain html content. Sep 23, 2015 at 22:39
  • I just tested locally on the latest build of Craft both in and outside of Matrix in the latest Chrome with Craft's stock Standard.json file by embedding a Youtube iframe and it worked fine after saving the entry.
    – Brad Bell
    Sep 24, 2015 at 0:53

1 Answer 1

2

If you can, update to the latest Craft build. There was a Redactor update in Craft 2.4.2682 back in July that updated Redactor and fixed issues with iFrames.

2
  • Thanks, Aaron. It's odd that Craft shows 1 update when there are actually 5 releases. Still, I should have looked for that more carefully. Sep 24, 2015 at 13:23
  • @KennethBenjamin - that'll make more sense when the plugin store is out. Craft counts as 1 update, then another for each plugin that needs an update.
    – Brad Bell
    Sep 24, 2015 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.