3 Replies Latest reply on Aug 30, 2013 10:41 AM by steve_ssh

    Web Viewer Content Black for Valid URL

    jsorge

      I have a web viewer that I'm setting via script (a la Jason Young's excellent new SQL Explorer from SeedCode). I build the HTML via script and when I set the content of the web viewer to the HTML it is black. However when I paste the source into a test file it works in Safari.

       

      The way I'm doing it is at startup exporting the CSS, JS & JQuery to a unique folder in the temporary path and setting a global variable to my HTML template that's linked to those files. The script will take the content that I want displayed and substitute it in, thus creating good HTML to display in the web viewer.

       

      FileMaker is showing the black box (shown in one image). Safari shows the content of the HTML (shown in the other image). I'm also attaching the entirety of my HTML. Can you see where am I falling down? Thanks for any help!

      jared

        • 1. Re: Web Viewer Content Black for Valid URL
          steve_ssh

          Hi Jared,

           

          My guess is that the black box effect is simply the result of the URLs for the resources not being successfully resolved by the webviewer.

           

              My guess for why the URLs are not being resolved is that the webviewer is not operating from a context where it understands that your URLs (such as the ones below) are to be resolved as files in the local file system.

           

                   href="/private/var/folders/56/2mjv8g350b5_ly60hkjcgn740000gq/T/S10/2F975F0C-CA08-48F2-9AFD-18F5405ACAFA/ui.jqgrid.css"

           

                   src="/private/var/folders/56/2mjv8g350b5_ly60hkjcgn740000gq/T/S10/2F975F0C-CA08-48F2-9AFD-18F5405ACAFA/jquery.js"

           

           

              Probably when you used your browser to test the HTML, you simply used the browser to open the file locally, and therefore the browser was operating from a context where it understood to resolve the resources as local files.

           

           

           

           

          My suggestion for some things to try:

           

          1) You could try changing all of your temp dir URLs to explicitly indicate that they are local files.  For example, the two URLs above would become:

           

               href="file:///private/var/folders/56/2mjv8g350b5_ly60hkjcgn740000gq/T/S10/2F975F0C-CA08-48F2-9AFD-18F5405ACAFA/ui.jqgrid.css"

           

               src="file:///private/var/folders/56/2mjv8g350b5_ly60hkjcgn740000gq/T/S10/2F975F0C-CA08-48F2-9AFD-18F5405ACAFA/jquery.js"

           

           

          2) This would be easier if it works:  You could try adding a base tag to the head portion of your HTML, using the href property to point to the local file system:

           

          <html lang="en">

          <head>

          <base href="file:///"/>

           

          ... rest of your code ...

           

           

           

          p.s.

           

          I'm not sure if I'm overlooking any extra gotchas that would apply if you plan to do this in FmGo.

           

           

           

          Hope this helps & kind regards,

           

          -steve

           

           


          • 2. Re: Web Viewer Content Black for Valid URL
            jsorge

            Hi Steve,

            I cracked open SQL Explorer and found that exact thing. Changing my linking to file:/// did just the trick. I'm not developing for Go, so that's not a problem. Thanks a bunch!

            jared

            • 3. Re: Web Viewer Content Black for Valid URL
              steve_ssh

              Super!  Thanks for letting me know how it turned out, Jared.

               

              Best,

               

              -steve