Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Best practice needed: Displaying arbitrary (potentially HTML) content from mails in the GUI

    Hi Isomorphic (or everyone else),

    I'm doing to develop a feature where mails BCCd to our system will be 'attached' to an object in our application and be displayed.
    Let's assume that I'll solve the multipart-mail and attachment problems I'll surly get, as these are not SmartGWT related.

    Nowadays, most mails are HTML mails. How would you best display this content? It will be some ListGrid to the left to select the mail you want to display and then on the right some widget to display the text.
    As I don't want HTML-tag-soup, this will be fetched with escapeHTML="false". But how do I display this content? Which widget do I use? There are many, if you search the Showcase for HTML. Do I need an iframe in there?

    Thank you & Best regards
    Blama

    #2
    Use an HTMLFlow or HTMLPane, as shown in our examples of displaying HTML. Be sure to use some (third-party) library to make sure the HTML content is properly sanitized, or you will introduce security issues.

    Comment


      #3
      Ok, thank you.

      Best regards
      Blama

      Comment


        #4
        Hi Isomorphic,

        I found the HTML sandbox attribute and wanted to ask whether this would solve this. I then saw that you already support this attribute.

        Wouldn't this also be a solution to my problem with (e.g. in this sample)?
        Code:
        isc.HTMLPane.create({
            width:230, height:150, showEdges:true,
            styleName:"exampleTextBlock",
            contents:"<!DOCTYPE html><html><head><title>Page Title</title></head><body onLoad='alert()'><h1>This is a Heading</h1><p>This is a paragraph.</p><script>alert('Hello');</script></body></html>",
            selectContentOnSelectAll:true,
            contentsType: "page"
        })
        Also, it seems that contents is always rendered as <div> and only contentsURL (which requests the wanted page though your proxy servlet) can render as <iframe>, is that correct?

        Best regards
        Blama

        Comment


          #5
          Hi Isomorphic,

          researching this it seems that you can't supply content for an iframe, but need to give an URL and the browser does the rest like here:

          In this sample one can see that contents can't be our solution, it must be contentsURL.
          Code:
          isc.HTMLPane.create({
              width:230, height:150, showEdges:true,
              styleName:"exampleTextBlock",
              contents:"<h1>This is a Heading</h1><p>This is a paragraph.</p><button onclick='alert()'>Click me</button>"
          })
          I assume that I could solve contentsURL if I can get the content somehow via IDACall or RestHandler with HTTP GET. Does IDACall support this? What would you suggest to solve this?

          Best regards
          Blama

          Comment


            #6
            contents URL is the URL that the actual HTML content comes from. This has nothing to do with IDACall or RestHandler. You just need the content to be returned from a URL.

            Comment

            Working...
            X