New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Built-in Content Filters

  • Show/Hide Border
  • Table Properties
  • Delete Table
  • Row
    • Insert Row Above
    • Insert Row Below
    • Delete Row
  • Column
    • Insert Column to the Left
    • Insert Column to the Right
    • Delete Column
  • Cell
    • Merge Cells Horizontally
    • Merge Cells Vertically
    • Split Cell Horizontally
    • Split Cell Vertically
    • Delete Cell
  • Cell Properties
  • Table Properties
  • Properties...
  • Image Map Editor
  • Properties...
  • OpenLink
  • Remove Link
  • Insert Select
  • Cut
  • Copy
  • Paste
  • Paste from Word
  • Paste Plain Text
  • Paste As Html
  • Paste Html
  • Built-in Filters Configurator
  • Filter List

Filters in RadEditor are small code snippets, which are called in a sequence to process the editor content, when the mode (html / design / preview) is switched. This example demonstrates the use of the editor's built-in content filters:

Content Filters Summary

Filter Name Description Default State Category
RemoveScripts Removes script tags from the editor content Enabled Security
EncodeScripts Encodes all script tags from the content Enabled Security
StripCssExpressions Strips CSS expressions to reduce XSS possibility Enabled Security
StripDomEventAttributes Removes DOM event attributes to reduce XSS possibility Enabled Security
StripJavaScriptUris Removes dangerous JavaScript-based URI schemes from HTML attributes Enabled Security
MakeUrlsAbsolute Makes all URLs absolute (e.g., "https://server/page.html") Disabled URL Processing
FixUlBoldItalic Changes deprecated <u> tag to span with CSS style Enabled HTML Cleanup
IECleanAnchors IE only - removes current page URL from anchor links Enabled Browser-Specific
FixEnclosingP Removes parent <p> tag if all content is inside it Disabled Browser-Specific
MozEmStrong Changes <b> to <strong> and <i> to <em> in Mozilla - Obsolete since 2013 Q3 Enabled Browser-Specific
ConvertTags Changes <b>, <i>, <strike> to <strong>, <em>, <del> Enabled HTML Formatting
ConvertFontToSpan Changes deprecated <font> tags to compliant <span> tags Enabled HTML Formatting
OptimizeSpans Removes unneeded span elements Enabled HTML Cleanup
ConvertToXhtml Converts HTML to XHTML Enabled HTML Formatting
IndentHTMLContent Indents HTML content for readability Enabled HTML Formatting
ConvertCharactersToEntities Converts reserved characters to HTML entity names Enabled HTML Formatting
PdfExportFilter Fixes some PDF export issues Disabled Export
ConvertInlineStylesToAttributes Converts XHTML inline styles to email-compliant attributes Disabled Email
RemoveExtraBreaks Strips all extra breaks inside tags like <p>, <h1>, etc. Enabled HTML Cleanup
DefaultFilters Preset combination of 15 recommended filters Preset Configuration
💡 Note: DefaultFilters is a preset combination that includes 15 of the 19 available filters.

Filters included in DefaultFilters (15 filters):
  • RemoveScripts
  • EncodeScripts
  • StripCssExpressions
  • StripDomEventAttributes
  • StripJavaScriptUris
  • FixUlBoldItalic
  • IECleanAnchors
  • MozEmStrong
  • ConvertTags
  • ConvertFontToSpan
  • OptimizeSpans
  • ConvertToXhtml
  • IndentHTMLContent
  • ConvertCharactersToEntities
  • RemoveExtraBreaks

Filters NOT included in DefaultFilters (4 filters):
  • MakeUrlsAbsolute
  • FixEnclosingP
  • PdfExportFilter
  • ConvertInlineStylesToAttributes
⚠️ Security Warning: Disabling security filters (RemoveScripts, EncodeScripts, StripDomEventAttributes, StripJavaScriptUris, StripCssExpressions) can expose your application to XSS attacks. Only disable these filters if you fully trust the content source.

Detailed Filter Descriptions

  • RemoveScripts: this filter removes script tags from the editor content. Disable the filter if you want to insert script tags in the content. This filter is enabled by default. You can examine more details about this filter in Preventing Cross-site Scripting (XSS) article.
  • EncodeScripts: this filter encodes all script tags from the content. This filter is enabled by default. You can examine more details about this filter in Preventing Cross-site Scripting (XSS) article.
  • StripCssExpressions: this filter strips CSS expressions to reduce the possibility of cross-site scripting. This filter is enabled by default. You can examine more details about this filter in Preventing Cross-site Scripting (XSS) article.
  • StripDomEventAttributes: this filter removes attribute DOM events from the HTML elements to reduce the possibility of cross-site scripting. You can examine more details about this filter in Preventing Cross-site Scripting (XSS) article.
  • StripJavaScriptUris: this filter removes dangerous JavaScript-based URI schemes from HTML attributes to reduce the possibility of cross-site scripting. This filter is enabled by default. You can examine more details about this filter in Preventing Cross-site Scripting (XSS) article.
  • MakeUrlsAbsolute: this filter makes all URLs in the editor content absolute (e.g. "https://server/page.html" instead of "page.html").
  • FixUlBoldItalic: this filter changes the deprecated u tag to a span with CSS style. This filter is enabled by default.
  • IECleanAnchors: Internet Explorer only - this filter removes the current page url from all anchor(#) links to the same page. This filter is enabled by default.
  • FixEnclosingP: this filter removes a parent paragraph tag if the whole content is inside it.
  • MozEmStrong: this filter changes b to strong and i to em in Mozilla browsers. This filter is enabled by default. - This filter is obsolete since Telerik UI version 2013 Q3
  • ConvertTags: this filter changes <b>, <i> and <strike> tags successively to <strong>, <em> and <del>. This filter is enabled by default.
  • ConvertFontToSpan: this filter changes deprecated font tags to compliant span tags. This filter is enabled by default.
  • OptimizeSpans: this filter removes unneeded span elements. This filter is enabled by default.
  • ConvertToXhtml: this filter converts the HTML from the editor content area to XHTML. This filter is enabled by default.
  • IndentHTMLContent: this filter indents the HTML content so it is more readable when you view the code. This filter is enabled by default.
  • ConvertCharactersToEntities: this filter converts reserved characters to their html entity names. This filter is enabled by default.
  • PdfExportFilter: this filter fixes some pdf export issues.
  • ConvertInlineStylesToAttributes: this filter converts XHTML compliant inline style attributes to Email compliant element attributes.
  • RemoveExtraBreaks: this filter strips all extra breaks inside some tags like p, h1, etc. This filter is enabled by default.
  • DefaultFilters: this is a preset combination that includes 15 recommended content filters for comprehensive content processing while maintaining security. The following filters are included: RemoveScripts, EncodeScripts, StripCssExpressions, StripDomEventAttributes, StripJavaScriptUris, FixUlBoldItalic, IECleanAnchors, MozEmStrong, ConvertTags, ConvertFontToSpan, OptimizeSpans, ConvertToXhtml, IndentHTMLContent, ConvertCharactersToEntities, and RemoveExtraBreaks.

    The following 4 filters are NOT included: MakeUrlsAbsolute, FixEnclosingP, PdfExportFilter, and ConvertInlineStylesToAttributes. These can be added individually if needed for specific scenarios.

How to Configure Filters

Filters in RadEditor can be set in the markup:

<telerik:RadEditor ID="RadEditor1" ContentFilters="DefaultFilters" runat="server" />

or combine DefaultFilters with additional filters like PdfExportFilter:

<telerik:RadEditor ID="RadEditor1" ContentFilters="DefaultFilters,PdfExportFilter" runat="server" />

as well as in the code behind:

C#
RadEditor1.ContentFilters = Telerik.Web.UI.EditorFilters.DefaultFilters | Telerik.Web.UI.EditorFilters.PdfExportFilter;
VB.NET
RadEditor1.ContentFilters = Telerik.Web.UI.EditorFilters.DefaultFilters Or Telerik.Web.UI.EditorFilters.PdfExportFilter

Filters can also be enabled/disabled individually through EnableFilter() and DisableFilter() methods (e.g. RadEditor1.DisableFilter(Telerik.Web.UI.EditorFilters.MakeUrlsAbsolute))

Related Resources

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • styles.css
<%@ Page Language="vb" Theme="Default" AutoEventWireup="true" CodeFile="DefaultVB.aspx.vb"Inherits="Telerik.Web.Examples.Editor.ContentFilters.DefaultVB"  %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
<link href="../Common/styles.css" rel="stylesheet" type="text/css" />
    <link href="styles.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-containers">
    <div class="demo-container">
        <telerik:RadEditor RenderMode="Lightweight" runat="server" ID="RadEditor1" Height="500px" Width="1000px" EnableResize="false"
            SkinID="DefaultSetOfTools">
            <Modules>
                <telerik:EditorModule Name="RadEditorStatistics" dockingzone="Bottom" Visible="true"
                    Enabled="true"></telerik:EditorModule>
                <telerik:EditorModule Name="RadEditorDomInspector" Visible="false" Enabled="true"></telerik:EditorModule>
                <telerik:EditorModule Name="RadEditorNodeInspector" Visible="false" Enabled="true"></telerik:EditorModule>
                <telerik:EditorModule Name="RadEditorHtmlInspector" Visible="false" Enabled="true"></telerik:EditorModule>
            </Modules>
            <Content>
            <img alt="product logo" src="../../images/productLogoLight.gif" />is the successor of the well known industry standard Editor for ASP.NET. The tight integration with ASP.NET AJAX and the powerful new capabilities make Telerik's WYSIWYG Editor a flexible and lightweight component, turning it into the fastest loading Web Editor. Among the hottest features are: 
            <ul>
                <li><em>Single-file, drag-and-drop deployment</em></li>
                <li><em>Built on top of ASP.NET AJAX</em></li>
                <li><em>Unmatched loading speed with new semantic rendering </em></li>
                <li><em>Full keyboard accessibility</em></li>
                <li><em>Flexible Skinning mechanism</em></li>
                <li><em>Simplified and intuitive toolbar configuration</em></li>
                <li><em>Out-of-the-box XHTML-enabled output</em></li>
            </ul>
            </Content>
        </telerik:RadEditor>
    </div>
    </div>

    <telerik:RadAjaxManager ID="RadAjax1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="SetFiltersButton">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadEditor1" LoadingPanelID="LoadingPanel1"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="FilterCheckboxList"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RestoreDefaults">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadEditor1" LoadingPanelID="LoadingPanel1"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="FilterCheckboxList"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1"></telerik:RadAjaxLoadingPanel>

    <qsf:ConfiguratorPanel runat="server" Title="Built-in Filters Configurator" ID="ConfigurationPanel1">
        <Views>
            <qsf:View>
                <ul class="fb-group">
                    <li><qsf:CheckBoxList ID="FilterCheckboxList" runat="server" CssClass="filter-list" Label="Filter List">
                    </qsf:CheckBoxList></li>
                    <li><qsf:Button ID="SetFiltersButton" runat="server" Text="Update" OnClick="SetFiltersButton_Click" Size="Medium"></qsf:Button>
                    <qsf:Button ID="RestoreDefaults" runat="server" Text="Reset" OnClick="RestoreButton_Click" Size="Medium"></qsf:Button></li>
                </ul>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance