Reputation: 1663
Some people post the html of blog post that they want to share on our site. However, iframes are not permitted on our site, so I want to check the entered code that none were entered into the TinyMCE editor.
I am running a validation javascript on submission and it has the following code:
if (ErrorFound == 0)
{
if (tinyMCE.get("entryText").getContent().indexOf("<iframe") != -1)
{
alert("iframes are not accepted on this site as they can be used maliciously, please remove the offending code.");
document.frmBlogEntry.entryText.focus();
ErrorFound = ErrorFound + 1
}
}
What am i doing wrong? as when this is executed it is ignored. It must be something obvious that I am missing.
Would really appreciate your help. Many thanks in advance, Paul
Upvotes: 1
Views: 304
Reputation: 1663
I solved it by assigning getContent() to a variable first and then checking the indexof, was just a javascript problem.. nothing related to tinymce. Many thanks
Upvotes: 0
Reputation: 38147
By default the TinyMCE Editor cleans the output from the editor .... this link shows the default list of elements allowed
http://www.tinymce.com/wiki.php/Configuration:valid_elements
the iframe
tag is not on that list of valid elements (the default one) - i would suggest that its being removed by the editor itself ....
Upvotes: 2