Embedding Youtube videos in tinymce

NOTICE– TECHNICAL JARGON ALERT

Tinymce is the wysiwyg editor of choice on millions of websites. It comes as standard in the Drupal CMS and is often used in bespoke content management systems.

However, when you try to embed a youtube video, Tinymce strips the code and stops the youtube videos from displaying.

The youtube code is wrapped in an iframe and it is this thatTinymce strips out.  This was done for security reasons, but it is easy to make a small alteration to the tinymce  init and get around the problem.

(This is the small bit of javascript code which sits on the actual page where the wysiwyg actually appears).

Simply add the following line to your init code and youtube videos will magically become embeddable.

extended_valid_elements : "iframe[src|title|width|height|allowfullscreen|frameborder]"