Brian's Blog

items I see across my tribes

BE.N: allow iframe in Editor

November 27
by briancarter 27. November 2009 10:05

The WYSIWYG editor (tinyMce) used in BE.N doesn't allow certain HTML tags by default.  I've seen this before with the OBJECT tag.  Fortunately, you can tell tinyMce to allow specific HTML tags.  Oftentimes, you have to also tell it which attributes of those tags it should also allow.

In the tinyMCE.ascx file in the admin folder, there's a tinyMCE.init() function call with a lot of parameters in there.  You can tell tinyMCE to allow an <iframe> tag via the "extended_valid_elements" property.  I added that below, does the trick (the part I added is in bold).  You can add more tags to extended_valid_elements also if needed.  It's a pipe delimited list.

tinyMCE.init({
...
theme_advanced_resizing: true,
extended_valid_elements: "iframe[name|id|src|frameborder|width|height|allowtransparency]",
tab_focus : ":prev,:next"
});

Now edit the page, click the HTML button.  Within the HTML, add an iframe – example below:

<iframe src="http://www.retaggr.com/Embed/BrianCarter" frameborder="0" width="360" height="300" allowtransparency="allowtransparency"></iframe>

Now you can add iframes to your pages.  Check out how I added in my retaggr shown below in an iframe:

 

Categories: Development

Comments

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading




 Questions or Feedback, my contact information is located on my About page.


The opinions, thoughts, and comments made in these blog posts are solely my own (unless otherwise stated). They do not reflect the opinions, thoughts or practices of my employer, my universities, my family, or anyone else. Also, I retain the right to change my mind about anything I publish here without having to go back and edit posts that occurred in the past. 

These are my opinions, or just as likely, someone else's opinions that I leveraged for my own.