This is a migrated thread and some comments may be shown as answers.

Disabling url navigation, running script and loading images from internet

1 Answer 89 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Yulia
Top achievements
Rank 1
Yulia asked on 04 Feb 2013, 09:41 AM
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.
Yulia.

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 06 Feb 2013, 04:13 PM
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,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Yulia
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or