I am using CKEditor and want to allow the insertion of embed code from YouTube, Vimeo etc. CKEditor turns all tags into HTML Chars equivalent, which is good, but I want it to make exceptions for this kind of content. iFrames seem to be how it's done nowadays, so how can I tell CKEditor to leave iFrame tags alone?
Thank you.
CKEditor comes with a
config.js
file. In this file, set the paramaterconfig.allowedContent
totrue
.For example,
I found this solution on the Amixa Blog. The blog post seems to be written for a specific CMS called ASPMAKER, and also recommends tweaks to specific ASP files in that CMS, but this edit to CKEditor config is generic, and applies to CKEditor wherever you're using it. The line
config.allowedContent = true;
is all you need.No. None of these answers are exactly accurate. The plugin is overkill for what you want to do. Do a project wide search for the following text:
extraAllowedContent
and add'iframe[!src];'
to whatever other allowed content is there. Then add the following:allowedContent: true,
Just found your question while searching for the same solution. Here is what I found. Basically, it adds a button to your toolbar like the Image button, but it pops up a box for you to paste the embed code from YouTube, Vimeo etc. into. Seems to work pretty well.
http://www.fluidbyte.net/index.php?view=embed-youtube-vimeo-etc-into-ckeditor
Edit: Link to archive.org: http://web.archive.org/web/20110805213357/http://www.fluidbyte.net/index.php?view=embed-youtube-vimeo-etc-into-ckeditor
The easy way is enabling the 'Source' button. If you use the full toolbar (not basic) it is already present.
Enabling the "Source" button does not solve this problem. Embed code such as "iframe" can then be pasted, but if you come back and edit the field a second time, CKeditor will have stripped it. You need to configure CKeditor to allow iframe embedding in the first place.