Bringing more HTML to Silverlight [HtmlTextBlock improvements]

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of

See you there!

Comments (11)
  1. rbirkby says:

    Inject the HTML into an IFrame in a different security context. This will give you the security you need.

  2. David Anson says:


    Thanks very much for the suggestion! If you have a pointer to more information about this approach, I’d love to understand the implications a little better. According to my current understanding, moving to an IFRAME might let me use a different security context, but if I can’t also turn off JavaScript entirely then I’m concerned the basic vulnerability still exists – even if it’s limited to annoying alert dialogs.

    On a related note, my concern about searching for "<script>…</script>" and ignoring it is that clever folks might be able to sneak the tags through anyway (ex: "<script >", etc.). I know I could use a Regex to do a pretty good job, but the underlying issue still concerns me. And even if I believed I’d addressed the <script> concern, I’d be worried about something like <img … onload="…" /> where script runs for an event handler instead.

    So if you’ve got a suggestion that lets me disable script entirely, then I’m definitely interested! 🙂

  3. WynApse says:

    Silverlight Cream for September 25, 2007

  4. says:

    Thanks a bunch for this great control!  It beings much needed HTML functionality back into Silverlight.  Any way to get the links to actually fire?  Maybe via a HtmlPage.Navigate() call or something?

  5. David Anson says:


    I explain why links don’t navigate in the third "note" of the initial post. Per your suggestion, .Navigate would be a good way to do the navigation – but the difficulty is in detecting the click of the link instead! 🙂 Basically, there doesn’t seem to be a good way to detect a click *on the link itself* at the moment. While it would be possible to detect a click on the HtmlTextBlock, that would only seem to make sense if there were exactly one link present. So for lack of a good way to support this, I chose not to for now. However, if you have a scenario where it makes sense to behave differently, by all means do so! 🙂

  6. I think today is the start for great things to come. And why? Because I had my first article published

  7. Delay's Blog says:

    A few months ago when Silverlight 1.1 Alpha was all the rage, I wrote a sample control that made a best-effort

  8. Delay's Blog says:

    A customer recently asked about an update to my HtmlTextBlock sample for the newly released Silverlight

  9. Delay's Blog says:

    A couple of readers have asked about an update to my long-running HtmlTextBlock sample for Silverlight

  10. Delay's Blog says:

    I updated my HtmlTextBlock sample for RTW last night and got an email from kind reader Ed Silverton this

Comments are closed.