11 Replies Latest reply on Oct 4, 2012 6:07 AM by mikebeargie

    Odd webviewer behavior on mac

    CapitolContender

      We have an FM11 solution with a web viewer loading calculated HTML from a field.

       

      The calculated URL is: "data:text/html," & TABLE::htmlData

       

      We are using a jquery/javascript package to style tooltip popups over an image map. (qTip, http://craigsworks.com/projects/qtip/)

       

      While this works on windows, the javascript does not work on Mac. Even more odd, if we host the HTML off our website and feed the link into the mac web viewer, it DOES work.

       

      Does anyone know of any fix to the behavior of feeding HTML directly into the web viewer that would cause this to not work? I've attached the html file for you to test in your own environment.

        • 1. Re: Odd webviewer behavior on mac
          Malcolm

          We have an FM11 solution with a web viewer loading calculated HTML from a field.

           

          The calculated URL is:  "data:text/html," & TABLE::htmlData

           

          We are using a jquery/javascript package to style tooltip popups over an image map. (qTip, http://craigsworks.com/projects/qtip/)

           

          While this works on windows, the javascript does not work on Mac. Even more odd, if we host the HTML off our website and feed the link into the mac web viewer, it DOES work.

           

          Does anyone know of any fix to the behavior of feeding HTML directly into the web viewer that would cause this to not work?

           

          I've had similar problems with javascript. The workaround is too save the html to file in the temp directory and point the web viewer at it.

           

          Malcolm

          1 of 1 people found this helpful
          • 2. Re: Odd webviewer behavior on mac
            mikebeargie

            Hey Malcolm,

             

            I've been playing around with this a bit more but still can't seem to get it to work.

             

            I tracked down the generated HTML file in finder and open it up, but the javascript elements do not appear to work in safari either in the generated file. If I host the same file off my website and type in a url to the file though it does work in Safari.

             

            Can you provide some more details as to how you were able to get it to work. Or would you be willing to take a look at a sample .fmp12 file if I posted it?

            • 3. Re: Odd webviewer behavior on mac
              databuzz

              Hi Mike,

               

              How are you generating the HTML file? Are you using Export Field Contents or exporting a single field/record? I've had problems in the past with using Export Field Contents for html files that contain Javascript due to the UTF-16 encoding.

               

              Andrew

               

              FileMaker 12/11/10/9/8 Certified Developer

              Databuzz

              - - - - - - - - - - - - - - - - -

              Phone: +61 2 9484 6565

              Mobile: +61 418 468 103

              Email: andrew@databuzz.com.au

              http://www.databuzz.com.au

              1 of 1 people found this helpful
              • 4. Re: Odd webviewer behavior on mac
                steve_ssh

                Hi Mike,

                 

                Another thing to double-check would be to make sure that HTML source doesn't have any relative URL paths which don't resolve from the perspective of the local file.

                 

                Also: Have you tried using the Safari developer tools to see if any errors are logged to the console when you load the page in browser from the local file?

                 

                HTH & best,

                 

                -steve

                • 5. Re: Odd webviewer behavior on mac
                  mikebeargie

                  Hey Andrew,

                   

                  I was using export field contents, setting a path to "file:" & get(temporaryPath) & "webview.html"

                   

                  I attempted the alternative of exporting record as text with the same path above, and that seems to break the javascript components on both windows and mac.

                   

                  Was there a specific file format or way I should be exporting to try getting around the encoding issue?

                  • 6. Re: Odd webviewer behavior on mac
                    mikebeargie

                    Hi Steve,

                     

                    All of my files are full-path static links to hosted files. I will see about using safari tools to see if there's any errors being generated. So you know though, when I host the same HTML code on my web server and go to it in safari, it does load fine. I hope I can spot a difference between the two.

                    • 7. Re: Odd webviewer behavior on mac
                      beverly

                      Mike, yes.

                       

                      http://www.filemakerhacks.com/?p=6045

                       

                      -- sent from my iPhone4 --

                      Beverly Voth

                      --

                      • 8. Re: Odd webviewer behavior on mac
                        databuzz

                        Hi Mike,

                         

                        You might be experiencing the same issue that I encountered with html files generated from FileMaker Pro that contain Javascript code. You want to generate a UTF-8 file - I've never had any problems with UTF-8 encoding, but you can't use Export Field Contents.

                         

                        You can try creating the file using the link that Beverly suggested. I've also used the (free) BaseElements plugin to create an html file on disk with UTF-8 encoding.

                         

                        hth,

                        Andrew

                         

                        FileMaker 12/11/10/9/8 Certified Developer

                        Databuzz

                        - - - - - - - - - - - - - - - - -

                        Phone: +61 2 9484 6565

                        Mobile: +61 418 468 103

                        Email: andrew@databuzz.com.au

                        http://www.databuzz.com.au

                        • 9. Re: Odd webviewer behavior on mac
                          beverly

                          And, of course, CSS and JavaScript should never be IN html pages, just calls to them as resources. That solves a lot of my problems of things not working for some reason (xhtml suggests this separation, too.)

                           

                          Beverly

                          • 10. Re: Odd webviewer behavior on mac
                            steve_ssh

                            Hi Mike,

                            Mike Beargie wrote:

                             

                            So you know though, when I host the same HTML code on my web server and go to it in safari, it does load fine. I hope I can spot a difference between the two.

                             

                            By "load fine", you do mean loads and functions properly, correct?

                             

                            This difference is precisely the point that intrigues me:  It works when served by a server;  it does not work when "served" as a local file.

                             

                            Though I am sure that there are more possible reasons, the only two explanations for this sort of difference that I can think of are:

                             

                              1) The one I mentioned:  A relative path that works from the server does not work from the local file perspective.

                             

                               2) Use of XMLHttpRequest within the Javascript code

                             

                            Hopefully the developer tools in Safari will throw you a good clue as to what error(s) might be happening when the file is loaded locally.

                             

                            Very best,

                             

                            -steve

                            • 11. Re: Odd webviewer behavior on mac
                              mikebeargie

                              Hey Beverly,

                               

                              I think this did it for me. I had a short script to load my javascript functions in the header, I changed that to be in an external file and it appears to work correctly in Mac now.

                               

                              Also I did change from export field contents to export record, but that alone did not fix the issue.

                               

                              Thanks so much to everyone for the responses in helping me work through this!