4 Replies Latest reply on Apr 22, 2014 5:37 AM by beverly

    html in webviewer syntax tutorial


      I am looking for a clear tutorial to show syntax, structure and usage where I can keep HTML in fmPro field(s) and view them in a webviewer.

      Step 2 would be to get data OUT of the webviewer via the fmp syntax


      I've google and looked and can't find solid examples.


      Am away that the url needs to start with "data:text/html," but amd lost after that.


      Thanks in advance for any direction.

        • 1. Re: html in webviewer syntax tutorial
          1 of 1 people found this helpful
          • 2. Re: html in webviewer syntax tutorial

            steve_ssh (as always) has some great answers for you. Here are some of my 'takes' on the subject:


            I use these resources:



            • your usage in webviewer replaces [<mediatype>] with the text/html

            • you are probably not using the base64 (images), so can ignore the optional

            • you want to display something in the <data>

            • so your calc in the WV would be something like this:




            I've used the $$html variable in the example here, so that you can change the code via script to change what's displayed in a single WV. If you desire, this can be a pointer to a field (or fields) containing your HTML. The difference would allow you to use a WV on every record in a form view (not recommended in list view) and have it update according to the record.


                 "data:text/html," & myHTMLfield // don't forget the COMMA!!


                 2. data URL/URI/protocol/schema is meant to be a SNIPPET for inclusion in another page of full HTML already containing the head, body and other elements. Therefore, when used within a WV, it also need not have these elements. Since you may be limited (at some point) with the number of characters in the calc (especially if you *do* start using base64!), then you can strip out the elements that have no contributing factor to the result. Along with this, the extra 'whitespace' may help you read your HTML, but totally ignored, so stripping saves characters, too.


                 a. "data:text/html," & myfield & ""


                 is the same if you do this:


                 b. "data:text/html," & myfield


            That doesn't mean you cannot do the "FULL-HTML" within, it just means why bother?


                 3. yes, you can use HTML, CSS, JavaScript within the data URI!


                 4. yes, you can call external scripts and other resource, but this requires connection to the 'net and FULL-PATH to the resources (relative paths don't work so well with WV).


                 5. yes, you an have things like CSS and JS within globals (or other fields or variables) that can be used within your data URI calc to display the HTML, this means one set of these "resources" can be used again and again with variable HTML in records





            p.s. I may do this kind of calc to make it easy to read, debug and edit, but strip the returns when calc'd:


                 "data:text/html," &

                 Substitute ( List

                 ( ""
            ; ""
            ; ""
            ; ""
            ; ""
            ; ""
            ; ""
            ; myfield
            ; ""
            ; ""

                 ) ; "¶" ; "" )

            • 3. Re: html in webviewer syntax tutorial
              1. "data:text/html," is just for use WITHIN a filemaker client?  not for webDirect users?

              Or, could I use this to:

              1. Host html/php pages on my webserver and push out &name=value pair variables to populate those pages, based on data in Filemaker, for end users to see?
              2. Create php mail () pages (templates) which I could populate and send html from Filemaker?

              Would the above 2 items require a different schema than the "data:text/html,"?

              • 4. Re: html in webviewer syntax tutorial

                the data URI is used within the WebViewer to display HTML (or whatever). I don't know how it displays or behaves with WD for you - I suppose it depends on what you have in the HTML in your fields and what you are trying to accomplish with it.


                If you use html/php, it can be CustomWebPublishing (CWP), not WD (Instant). See the guide for CWP. That has nothing to do with what's in the WebViewer and data URI (although, you can use the data URI in your html, but why?).


                If you are trying to "publish" HTML that is in fields, you can export (as text) and ftp the created pages. Or the "view" in WV works for FMP (or FMGo) clients (and perhaps with WD).


                Please be a little more descriptive in your goals and perhaps we can figure which method(s) to use. Can you use CWP? do you know html/php? do you want to use WD? or ???