1 2 3 Previous Next 40 Replies Latest reply on Apr 10, 2016 7:32 AM by beverly

    How to display local html webpage with resources on webviewer?

    carlo.m

      I'm doing some tests with HTML5 using Hype. Now that I have exported the webpage as html5 I have the html file and the resources folder.

       

      Now how do I get it to show in a webviewer?

        • 1. Re: How to display local html webpage with resources on webviewer?
          Stephen Huston

          Assuming that you only want to view the local html file during testing (because that won't work on a served FM file), you could load it into a browser and copy the resulting URL into the web browser's data source area.

           

          Caveat: this used to work, I haven't tested a local html file with a webviewer in FM12.

          • 2. Re: How to display local html webpage with resources on webviewer?
            beverly

            You must know the local PATH (or if on a web server, the full path to the page)

             

            The local path is probably one of two locations: desktop (any folder) or documents (any folder) directories.

             

            If you are using FMServer, the path would be similar, but different to have the documents viewable by web viewer.

             

            I suggest you research these functions:

             

                 Get ( DesktopPath )

                 Get ( DocumentsPath )

                 Get ( SystemPlatform ) -- the "path" may be different depending on the platform!

             

            Beverly

            1 of 1 people found this helpful
            • 3. Re: How to display local html webpage with resources on webviewer?
              carlo.m

              I'm trying to achieve this with FMS. The goal is to leverage webviewer and html5 to create some nice UI.

               

              I'm using a Program called Hype to create the HTML5 animations, and I'm pleased with it. It is very easy to use...

               

              Using "file://localhost/Library/FileMaker%20Server/Data/Documents/LogInIntro/LogInIntro.html" I was able to get the page to show up on the host maching... ( my macbook pro at the moment ). How should I change this path to achieve this via another machine? What functions help me determine that path to make sure no matter the platform I get it to display?

               

              Thanks for the help!

              • 4. Re: How to display local html webpage with resources on webviewer?
                Stephen Huston

                The simple way to make sure the html page is always found from any machine for a hosted solution is to place the webpage on a website. You don't need to have a link to it from within othr pages on the site, but once it exists on a hosted website, you can use the  URL you would enter into a browser for your webviewer.

                 

                If it's not hosted, its going to become a problem with a hosted solution unless you can place it on the FM Server and get the FMServer file-URL to work from the server machine.

                1 of 1 people found this helpful
                • 5. Re: How to display local html webpage with resources on webviewer?
                  carlo.m

                  That is a great observation Stephen.

                   

                  This solution will be deployed in locations where internet connections are often shaky and intermittent. Thats is why I'm trying to get it to work by hosting the file within the FMS folder on the server or any other place on the local network. I guess ultimately, I store the local webpage resources in the file itself and have it export on the local computer upon deployment, but this seems tedious to mantain.

                   

                  Any ideas on how to get this to work are very appreciated...

                  • 6. Re: How to display local html webpage with resources on webviewer?
                    HammerOz

                    Hey Carlo,

                     

                    Did you ever get this working self contained in FM/ no hosted resources?

                     

                    Cheers

                    • 7. Re: How to display local html webpage with resources on webviewer?
                      beverly

                      another bump for this topic! use relative paths within the HTML/CSS/JS and then 'host' the files where any computer (or server) can see them.

                       

                      I have used "local" files rather than on server for this kind of HMTL displays in WV. Any docs can be stored with containers and text fields and exported if needed to local paths.

                       

                      Get( DocumentsPath)

                       

                      beverly

                      • 8. Re: How to display local html webpage with resources on webviewer?
                        HammerOz

                        Hi Beverly thanks for replying to both posts.

                         

                        Is it possible to reference a resource in a container directly?  Get( DocumentsPath) is not compatible with FMGo is it ?

                         

                        My goal is a self contained FMGo solution for therapists who can be working remotely.

                         

                        regards

                        • 9. Re: How to display local html webpage with resources on webviewer?
                          beverly

                          Get ( DocumentsPath ) is FMGo compatible.

                          You cannot reference files directly in containers. You can reference text (html) in fields in web viewer, but not containers. You would be wise to limit container fields for many reasons.

                           

                          beverly

                          • 10. Re: How to display local html webpage with resources on webviewer?
                            HammerOz

                            If we can't store containers externally in FMGo or reference the container, then how can I approach this ? hmmm

                            • 11. Re: How to display local html webpage with resources on webviewer?
                              HammerOz

                              Oh ok, so what exactly is that returning in FMGO? I get “var/mobile/ Containers..etc” How do you get a document into that location?

                              • 12. Re: How to display local html webpage with resources on webviewer?
                                HammerOz

                                oh it clicked at a Friday afternoon pace.

                                 

                                So you export the container contents with export field contents and specify $varas Get ( DocumentsPath )& filename And  alter the path in the Hype html / scripts to the same path and name ?


                                This is likely above by FM/JS/HYPE skill level ...

                                 

                                • 13. Re: How to display local html webpage with resources on webviewer?
                                  user19752

                                  If you can "Export Field Contents" with auto-open using browser, you will see where the html is saved. Do same URL work for web viewer?

                                  • 14. Re: How to display local html webpage with resources on webviewer?
                                    beverly

                                    yes, I'll expand this with some tests (scripts) then copying the paths in my browser from local file:

                                     

                                    Set Variable ( $$path ; optional param & "index.htm" )

                                    Export Field Contents ( table::field ; "$$path" ; Automatically open )

                                     

                                    1. $$path = "index.htm" (no optional parameter, use only the file name)

                                    result = "file:///Volumes/Macintosh%20HD/Users/... username .../... directories .../index.htm"

                                    note: this places the html in the same location as the "local" database file.

                                     

                                    2. $$path = Get ( DesktopPath ) & "index.htm"

                                    result = "file:///Volumes/Macintosh%20HD/Users/... username .../Desktop/index.htm"

                                    note: this places the html in the logged-in user's desktop directory

                                     

                                    3. $$path = Get ( TemporaryPath ) & "index.htm"

                                    result = "file:///Volumes/Macintosh%20HD/var/folders/... different temporary folders .../index.htm"

                                    note: this places the html into a temporary location that is available within the same script

                                     

                                    4. $$path = Get ( DocumentsPath ) & "index.htm"

                                    result = "file:///Volumes/Macintosh%20HD/Users/... username .../Documents/index.htm"

                                    note: this places the html into the user's Documents directory

                                     

                                    5. $$path = Get ( FileMakerPath ) & "index.htm"

                                    result = "file:///Volumes/Macintosh%20HD/Applications/FileMaker%20Pro%2014%20Advanced/index.htm"

                                     

                                    NOTES:

                                    • use only Get ( DocumentsPath ) or Get ( TemporaryPath ), as these work on local, FMGo, FMServer

                                    • using temporary is only available at the time of export, so set the result into WV and it will show as the script runs

                                    • using documents, of course will place ALL your necessary files in that directory (FMGo & FMServer & FMPro)

                                    • all links inside the "index.htm" will be relative for images and other documents, even though they may be exported using the same "path" from FileMaker.

                                     

                                    USING IN WebViewer:

                                     

                                    set your web viewer to (in "local" desktop/laptop):

                                    "file:/" & $$path

                                    for the first file (index.htm). Yes, you must put the protocol in there for Web Viewer, even though FM could save the file and (when automatically opened in the browser) prepends the correct protocol.

                                     

                                    • You may need to Refresh Object (the name of the web viewer as in Inspector).

                                     

                                    • For iOS/FMGo: you may need to adjust the path in Web viewer. For example, $$path alone may work.

                                     

                                    beverly

                                    1 2 3 Previous Next