I have been pulling my hair out trying to figure out how to get iframe to work correctly in TinyMCE.

Instead, I loaded the TinyTinyMCE module found here:

http://drupal.org/project/tinytinymce

And I was able to simply add the correct code.

Navigate to:

http://www.yoursite.com/?q=admin/settings/tinytinymce

In the window labelled: TinyMCE init script for advanced mode: *

find the line: extended_valid_elements : "a[name|href|target|title|onclick],img[style|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"

and add:

iframe[style|class|src|frameborder=0|alt|title|hspace|vspace|width|height|align|name]

to the end.

So that the line reads:

extended_valid_elements: "a[name|href|target|title|onclick],img[style|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],iframe[style|class|src|frameborder=0|alt|title|hspace|vspace|width|height|align|name]"

Save.

It should work fine.

I hope this helps someone.

CH

Comments

toodlepip’s picture

Had much the same issue myself. Ended up hacking around with TinyMCE, but found that switching over to the Wysiwyg module was much more stable. It sticks TinyMCE into its own folder, so you're not having to manually update TinyMCE for each update of the module.

There's also plenty of useful hooks, including hook_wysiwyg_plugin() that means it's possible to add extra configuration information to TinyMCE's setup without having to tinker with the core code.

I've written up a small module that sorts out the issue with iframe's so that they don't get stripped out of TinyMCE - very handy when you want to add complex Google Maps to your website. Hope it helps:

http://www.toodlepip.co.uk/blog/2009/12/using-iframes-drupals-wysiwyg-mo...