12 Replies Latest reply on Jun 16, 2014 10:25 AM by Mike Duncan

    FM Go - open local file in Safari

    datastride

      Folks,

       

       

      I am using FM Go to create an html file on an iPad. I put the html in a global text field, and then write the field to FM Go’s local directory (using Export Field Contents and a file extension of “html”).

       

      I can create the html file within FM Go’s “files on this device” and open it by checking “Automatically open file”, but the file doesn’t open in Safari. Instead it opens in a full-screen “browser” window inside FileMaker Go. Same thing happens if I navigate to FM Go’s “files on this device” and select the file from the list.

       

      I would like to open the file in Safari, rather than FM Go’s browser window, as the file contains JavaScript that does not execute in FM Go’s built-in browser view.

       

      I’ve tried using the “Open URL” script step in place of checking “Automatically open file”, but I cannot seem to construct a URL that will work. I only get a message saying “Failed to open My_File.html” . I’ve tried "file://My_File.html", "file://~/My_File.html", "file://%7E/My_File.html", and several other variations, but with the same resulting error message. Clearly I do not know how to format the URL so that it can be opened via the “Open URL” script step. I’ve searched and searched for a solution, but have yet to find an answer online.

       

      Any guidance would be greatly appreciated …

       

       

      P.S. I appologize for my first posting of this question that resulted in the hijacking of another thread.

        • 1. Re: FM Go - open local file in Safari
          Mike_Mitchell

          I ran into a similar problem with trying to open a PDF. Have you tried inserting a pause in the script? I think it might be due to a race condition between the creation of the file and the Open URL step trying to open it.

          • 2. Re: FM Go - open local file in Safari
            datastride

            Mike,

             

             

             

            A very logical suggestion, so thanks. But unfortunately it didn’t solve the problem. Still getting the “Failed to open “My_File.html” message.

             

             

             

            I think I may simply be building the URL incorrectly. If I knew for sure what format to use, then I could test with and without a pause.

             

             

             

            #end

             

            Peace, love & brown rice,

             

            Morgan Jones

             

             

             

            FileMaker + Web:  Design, Develop & Deploy

             

            Certifications: FileMaker 9, 10, 11, 12 & 13

             

            Member: FileMaker Business Alliance

             

            One Part Harmony <http://www.onepartharmony.com/>  

             

            Austin, Texas • USA

             

            512-422-0611

            • 3. Re: FM Go - open local file in Safari
              Mike_Mitchell

              Well, Beverly Voth offers a method on this thread:

               

              https://fmdev.filemaker.com/message/133640#133640

               

              Might work for you.

              • 4. Re: FM Go - open local file in Safari
                datastride

                Mike,

                 

                 

                 

                Great! File Is now opening via “Open URL” script step. I did not know the trick of using the “Get( DocumentsPath )” when accessing a file that was created without this directory specified. Beverly (and you) came thru once again.

                 

                 

                 

                Unfortunately my html page still opens in FM Go’s limited-functionality, built-in browser so my JavaScript is never firing. But at least the “Open in Safari” link is shown, so that’s progress. But when I touch the “Open in Safari” link, nothing happens (except that FM Go’s built-in browser window closes). The “I’m thinking” spinner is displayed for a second or two, but Safari is never launched.

                                                                                                So question #1: Why doesn’t the “Open in Safari” link work when the html file is displayed in FM GO’s built-in browser window?

                 

                 

                 

                And question #2: Does anyone know of a method to force the file to open in Safari automatically to begin with? (Of course an answer to question #2 renders question #1 superfluous.

                 

                 

                 

                #end

                 

                Peace, love & brown rice,

                 

                Morgan Jones

                 

                 

                 

                FileMaker + Web:  Design, Develop & Deploy

                 

                Certifications: FileMaker 9, 10, 11, 12 & 13

                 

                Member: FileMaker Business Alliance

                 

                One Part Harmony <http://www.onepartharmony.com/>  

                 

                Austin, Texas • USA

                 

                512-422-0611

                • 5. Re: FM Go - open local file in Safari
                  databuzz

                  Hi Morgan,

                   

                  I'm wondering if the reason you can't access an html file created by FileMaker Go and stored in one of the available FileMaker Go storage locations (Get ( DocumentsPath ) or Get ( TemporaryPath ) ) is due to the sandboxing rules in iOS where one app cannot access documents created/stored by another app? You can certainly use the "Open in Safari" share action to open external URL's in Safari (e.g. Youtube video) but if the file is stored in FileMaker Go's sandbox space other applications probably won't have access to that.

                   

                  You would normally use one of the iOS URL Schemes to call another application - to send a URL to Safari you would simply call a URL starting with "http". As we have no control over this in FileMaker Go and have to rely on the Open URL script step to launch any kind of URL we're limited to the functionality of the Open URL script step, which initially launches FileMaker Go "browser" first as you've noted.

                   

                  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

                  • 6. Re: FM Go - open local file in Safari
                    datastride

                    Andrew,

                     

                     

                     

                    Your answer seemed very logical to me, and so I did a bit more research. I found this article in the Apple Developer Library that confirms your theory:

                     

                     

                     

                         https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html

                     

                     

                     

                    Thus it seems there is no way at present to have Safari display an html file written to FileMaker Go’s directories. (Anyone know a trick way around this?)

                     

                     

                     

                    But as a result of closing this door, you also spurred me to think about a different approach. Because my solution is hosted, I can simply write the html file to a Remote Container field in a scratch table. Because I use Open Storage and because I have told IIS that my Remote Container directory is a “web site”, I can just give have FileMaker Go use Open URL to access the now “hosted” file.

                     

                     

                     

                    I’ll give this a try and report back.

                     

                     

                     

                    Thanks for your thoughtful response and for nudging me in a better direction.

                     

                     

                     

                    #end

                     

                    Peace, love & brown rice,

                     

                    Morgan Jones

                     

                     

                     

                    FileMaker + Web:  Design, Develop & Deploy

                     

                    Certifications: FileMaker 9, 10, 11, 12 & 13

                     

                    Member: FileMaker Business Alliance

                     

                    One Part Harmony <http://www.onepartharmony.com/>  

                     

                    Austin, Texas • USA

                     

                    512-422-0611

                    • 7. Re: FM Go - open local file in Safari
                      beverly

                      uh, say again? it's that rather unsecure, or does it not matter?

                       

                      Beverly

                      • 8. Re: FM Go - open local file in Safari
                        beverly

                        Ok, this may be an answer if and only if FMGo has this ability:

                         

                        "One exception to this rule occurs when an app uses public system interfaces to access things such as the user’s contacts or music. In those cases, the system frameworks handle any file-related operations needed to read from or modify the appropriate data stores."

                         

                        Bento had some of this ability because it could access other apps storage.

                         

                        But Safari would need to have this ability to read the file that is output (from FMGo) and/or FMGo needs to be able to "save" documents where Safari can see them?

                         

                        Beverly

                        • 9. Re: FM Go - open local file in Safari
                          datastride

                          Beverly,

                           

                           

                           

                          I read that part, but I don’t have any idea how one would tell FM Go to write to the public system area.

                           

                           

                           

                          Does anyone have an idea as to whether this might be possible?

                           

                           

                           

                          #end

                           

                          Peace, love & brown rice,

                           

                          Morgan Jones

                           

                           

                           

                          FileMaker + Web:  Design, Develop & Deploy

                           

                          Certifications: FileMaker 9, 10, 11, 12 & 13

                           

                          Member: FileMaker Business Alliance

                           

                          One Part Harmony <http://www.onepartharmony.com/>  

                           

                          Austin, Texas • USA

                           

                          512-422-0611

                          • 10. Re: FM Go - open local file in Safari
                            LyndsayHowarth

                            Write to a shared volume like Dropbox or iCloud then use http as Malcolm suggests...

                             

                            Sent from my iPad

                            Lyndsay Howarth

                            11th Hour Group Pty Ltd

                            • 11. Re: FM Go - open local file in Safari
                              beverly

                              Lyndsay, do you have the "path" for writing (from FileMaker) to DropBox or iCloud??

                               

                              Beverly

                              • 12. Re: FM Go - open local file in Safari
                                Mike Duncan

                                Hi Morgan,

                                 

                                Javascript runs in a web viewer, so could it simply load there? I haven't used the built in web browser like you outline, so I don't know if there are similar javascript limitations, or what exactly you're trying to do with javascript. Would you run into the same limitations with safari on ios?

                                 

                                Mike