Disabling url navigation, running script and loading images from internet

2 posts, 0 answers
  1. Yulia
    Yulia avatar
    2 posts
    Member since:
    Jun 2010

    Posted 04 Feb 2013 Link to this post

    Hi, all!
    I have a task to display document from html in RadRichTextBox, but without any working links, with prevention of loading smth. from internet (for example displaying images with url source) and disabling any script. How can I reach this purpose?
    I tried HtmlFormatProvider.Import() with RadDocument , and HtmlDataProvider in XAML. Please help.
  2. Petya
    Petya avatar
    983 posts

    Posted 06 Feb 2013 Link to this post

    Hello Yulia,

    Indeed, HtmlFormatProvider and HtmlDataProvider are the classes you should use if you want to import HTML content in RadRichTextBox. However, they do not expose API that can help you in achieving your goal.

    One possible resolution would be to subscribe to the DocumentChanged event of RadRichTextBox and handle the cases which you want to exclude - i.e. remove all hyperlinks pointing to an external location from the RadDocument.

    However, I believe the best approach to implement your scenario would be to preprocess the document before executing the import. You can do so in various different ways, for example using regular expressions. You should be aware that all scripts in the file will be excluded on importing, so they do not need additional processing.

    I hope this helps!

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top