IFrame tag stripped out

12 posts, 0 answers
  1. Richard Earle
    Richard Earle avatar
    10 posts
    Member since:
    Mar 2009

    Posted 17 Oct 2011 Link to this post

    Hi,

    I'm using version 5.6.2 in a WCM scenario, and am having problems adding an iframe into the HTML.

    In my page layout I have the editor specified like this:

    <telerik:RadHtmlField runat="server" DisplayWidth="100%" ID="docAbstract" FieldName="ACAbstract" InputFieldLabel="Article content" AllowSpecialTags="True" AllowScripts="True"/>

    I have also made AllowScripts True in the ConfigFile.xml, but it's still stripping out the tag on saving the page.  Is there something I'm missing? 

    Thanks,

    Richard
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 17 Oct 2011 Link to this post

    Hello Richard,

    If you want to insert and save IFRAME in RadEditor for MOSS it depends in what scenario you are using the control.

    1. In WebPart scenario there is no problem saving IFRAME element.
    2. In WCM scenario you need to set the AllowSpecialTags property of RadHtmlField to true. Unfortunately you can not do this by modifying the ConfigFile.xml. The only way is to use SharePoint designer as it is explained in the following online help aritlce http://www.telerik.com/help/aspnet-ajax/using-radeditor-in-web-content-management-scenario.html and add RadHtmlField such as:
    Copy Code
    <telerik:RadHtmlField id="..." FieldName="..." AllowSpecialTags="true" runat="server"></telerik:RadHtmlField>

    If this does not work in version 5.6.2 upgrade to the latest one 5.8.11 and test it.

    3. In list scenario (list, wiki, blog) the SharePoint content filters will always strip IFRAME elements. RadEditor does not control the content upon saving or rendering.



    Greetings,
    Rumen
    the Telerik team
    Learn how the Telerik controls can be integrated in SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 and SharePoint 2007 demo sites.

  3. Richard Earle
    Richard Earle avatar
    10 posts
    Member since:
    Mar 2009

    Posted 17 Oct 2011 Link to this post

    Thanks for the prompt response.

    As explained, I'm in the WCM scenario.  And, as you can see in my original post, I already have that attribute specified.

    I saw this post in the documentation:

    http://www.telerik.com/help/aspnet-ajax/moss-scripts-in-radeditor.html

    This is for scripts, but I thought maybe the same could be said for iframes?  If so, it does look like it should work for v5.6.2.  Is there any way you can check at all?  Unfortunately, I don't think upgrading is an option.

    Thanks for your assistance.
  4. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 17 Oct 2011 Link to this post

    Hi Richard,

    I tested <telerik:RadHtmlField version 5.6.2 in the WCM scenario and I was able to save an iframe in MOSS 2007. You can see my test in the following video:
    http://screencast.com/t/kSaWx2QOvaV0


    Kind regards,
    Rumen
    the Telerik team
    Learn how the Telerik controls can be integrated in SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 and SharePoint 2007 demo sites.
  5. Richard Earle
    Richard Earle avatar
    10 posts
    Member since:
    Mar 2009

    Posted 18 Oct 2011 Link to this post

    Thanks for the demo, Rumen - it's good to know if should work.  Now all I have to do is figure out where I've gone wrong!

    In my layout, at the top I have this registration:
    <%@ Register TagPrefix="telerik" Namespace="Telerik.SharePoint.FieldEditor" Assembly="RadEditorSharePoint, Version=5.6.2.0, culture=neutral, PublicKeyToken=1f131a624888eeed" %>

    Then in the layout HTML, the field looks like this:
    <telerik:RadHtmlField AllowSpecialTags="true" runat="server" DisplayWidth="100%" ID="docAbstract" FieldName="ACAbstract" InputFieldLabel="Article content" />

    And the HTML I'm trying to insert looks like this:
    <div><iframe src="http://www.youtube.com/embed/rNNr8pnzGRo"></iframe></div>

    It shows in the design view of the control, but the iframe gets stripped out on saving, leaving only the surrounding div. Can you see anything wrong?

    Thanks.
  6. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 18 Oct 2011 Link to this post

    Hello Richard,

    Could you please tell me whether the
    <div><iframe src="http://www.youtube.com/embed/rNNr8pnzGRo"></iframe></div>
    content is stripped when toggling to HTML mode of RadEditor? If it resides unchanged than the problem is  due to the built-in filters of MOSS, which we could not disable.

    Does the problem happen only when loading flash content in an iframe or you are able to reproduce it with any pages loaded in an iframe?


    Greetings,
    Rumen
    the Telerik team
    Learn how the Telerik controls can be integrated in SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 and SharePoint 2007 demo sites.
  7. Richard Earle
    Richard Earle avatar
    10 posts
    Member since:
    Mar 2009

    Posted 18 Oct 2011 Link to this post

    I start in HTML mode to enter the iframe.  If I toggle to design mode and back again, it stays.  If I choose "Save and stop editing" or check in the page, then it gets stripped out.  If I just choose "save" from the page menu, it appears to stay, although if I then open a new window and browse to the page it appears to have been stripped out again.

    I tried changing the source to the Telerik site (as in your demo), or to have no source at all, and it still got stripped out in both cases.

    It seems strange that it worked in your demo when I can't see that there's anything different in my version.  I'm trying to think of what else could be different.
  8. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 19 Oct 2011 Link to this post

    Hello Richard,

    If the iframe tag stays in HTML mode of RadEditor it is not a problem with RadEditor, but a MOSS behavior.

    Best wishes,
    Rumen
    the Telerik team
    Learn how the Telerik controls can be integrated in SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 and SharePoint 2007 demo sites.
  9. Richard Earle
    Richard Earle avatar
    10 posts
    Member since:
    Mar 2009

    Posted 19 Oct 2011 Link to this post

    OK - but how then did it work in your demo?
  10. Richard Earle
    Richard Earle avatar
    10 posts
    Member since:
    Mar 2009

    Posted 19 Oct 2011 Link to this post

    In fact, it stays in your demo in HTML view too, looking at it again.

    I don't really understand why it would get stripped out of the HTML view of the RadEditor.  I think I must have misunderstood what you're saying!
  11. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 20 Oct 2011 Link to this post

    Hello Richard Earle,

    Let me explain in more details.

    RadEditor has its own content filters (ConvertToXhtml, ConvertFontToSpan, RemoveScripts and other) which parse and modify the content. The filters are executed only when switching to HTML mode or when submitting the content. The content displayed in HTML mode is the same submitted to the server and saved in SharePoint database.

    Since the iframe is not stripped in HTML mode this means that the it is not RadEditor that strips the IFRAME element, but the content validation filters of SharePoint, which cannot be manipulated or stopped with code.

    I am not sure why the iframe is not stripped by SharePoint on my PC with the same version of RadEditor. I just showed you that the iframe is not stripped by RadEditor.

    Are you able to save the iframe using the default built-in SharePoint editor after disabling the RadEditor feature in the manage site features configuration page?


    Best regards,
    Rumen
    the Telerik team
    Learn how the Telerik controls can be integrated in SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 and SharePoint 2007 demo sites.
  12. Richard Earle
    Richard Earle avatar
    10 posts
    Member since:
    Mar 2009

    Posted 20 Oct 2011 Link to this post

    Oh, I see - that makes sense.

    No, I can't save the iframe using the built-in editor either.

    I can always create a bespoke layout with the iframe in the page body and a site column just for the source - but it would obviously be easier just to do it in the HTML editor.
Back to Top