I am using TinyMCE 3.4.9 and am trying to force the media plugin to always use the Flash embedding instead of iFrame embedding.
For security reasons, I don’t want to allow any embedding of iFrames.
I have formatted the URL manually to get a Flash embed object instead of the iFrame object.
IE-
- Flash embed: http://www.youtube.com/v/fWNaR-rxAic
- iFrame embed:
http://www.youtube.com/watch?v=fWNaR-rxAic
Is there a way to do one of the two:
- Onchange of the embed file/URL field, modify the URL so that the Flash object will be embedded by default. (http://www.youtube.com/watch?v=fWNaR-rxAic would be converted to http://www.youtube.com/v/fWNaR-rxAic)
- Change the call to youtube so that youtube will return the Flash object instead of the iFrame.
My TinyMCE initialization code is:
<script language="javascript" type="text/javascript">
tinyMCE.init(
{
paste_remove_styles : true,
gecko_spellcheck : true,
theme_advanced_font_sizes : "1,2,3,4,5",
extended_valid_elements:"script[charset|defer|language|src|type]",
theme : "advanced",
mode: "exact",
plugins: "inlinepopups,emotions,searchreplace,paste,media",
elements : "blogcontent",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,sub,sup,|,fontselect,fontsizeselect,forecolor,|,link,unlink,|,backcolor",
theme_advanced_buttons2 : "justifyleft,justifycenter,justifyright,|,search,replace,|,image,charmap,emotions, media,|,undo,redo",
theme_advanced_buttons3 : "",
theme_advanced_resize_horizontal : false,
theme_advanced_resizing : false,
file_browser_callback : 'file_browser',
relative_urls : false,
remove_script_host : false,
paste_retain_style_properties : "font-size,color,font-family,background-color",
setup :
function(ed)
{
ed.onKeyUp.add(
function(ed, e)
{
ed.nodeChanged();
}
);
}
}
);
</script>
Thanks,
Since I haven’t found a way to force flash embedding of youtube videos I created a work around for the iframe security problem.
I have added the iframe to the allowed tags list and on display of the content to the user after saving, I have a whitelist filter applied to any iframes that pulls out any iframes that don’t have a src in the whitelist.
Hope this helps.