Forum

Thread tagged as: Question

YouTube Embed (iFrame) within a blog post

I want my user to be able to paste an iframe using the "Source" formatting option when writing a blog post. When I do this the video shows up, but the pasted code disappears. Is there a way around this?

https://cl.ly/2M402k1p2W23

Danny Turley

Danny Turley 0 points

  • 4 years ago
Simon Clay

Simon Clay 127 points

Hi Danny, it's likely that CK Editor is removing the iframe tags. You can adjust the config to allow them not to be stripped out here: https://www.amixa.com/blog/2014/09/03/ckeditor-4-2-or-later-will-not-allow-iframe-or-other-html-tags/

But it might be just as easy (and perhaps nicer for your user) to add a YouTube video button instead: https://ckeditor.com/addon/youtube

Hi Simon, trying to add the YouTube button now. When I change the CKeditor config.js file, nothing seems to be happening. Do I have the correct folder structure? https://cl.ly/0T2u2Z2p1x1H

Simon Clay

Simon Clay 127 points

Yes, that's the right place, I added config.extraPlugins = 'youtube'; at the end, just before the };

I had to empty the browser cache to see the new button.

Ah, sneaky browser caching. Got it, thanks!

Simon Clay

Simon Clay 127 points

I know! It had me stumped first time around :)