6 Replies Latest reply on May 18, 2017 10:31 AM by smower

    Webdirect call a script twice ??



      i have a question and if someone have the idea


      i have a script to check a variables, this come from browser by GET


      then i set in "File Options" -> Scripts Triggers -> OnFirstWindowOpen

      i load my script there.


      and is when my problem start, because i need to start this script in this event

      to block users to access the system direct.


      but to get my parameters from URL i need to call like this




      and the same script load in OnFirstwindowOpen and when i call by url this is loaded again

      and i cant get the parameters


      if i remove the event from Scripts Triggers, i get the parameters but the validation to block users to access

      dont work, because the script is not loaded.


      sorry for this long post.

        • 1. Re: Webdirect call a script twice ??

          because the script is not loaded.

          It would not be loaded until after login.


          However, with FileMaker 16 you can now login to WebDirect using POST. This is definitely the best way to allow direct external access to the system, as GET parameters can be exploited.


          FileMaker 16 WebDirect Guide See "Signing in with HTTP POST"

          • 2. Re: Webdirect call a script twice ??

            Thats great, but i still using FileMaker 14.


            The way i doing is the right way ? or do you know a better solution ?

            • 3. Re: Webdirect call a script twice ??

              I’d recommend upgrading to 16 specifically for this reason.


              There are also other great reasons to upgrade, like speed improvements and compatibility with more browsers (including mobile browsers) that were not in 14.


              Also, FMS16 supports up to 500 WebDirect users now with the proper licensing and hardware.



              In terms of doing it in 14, I would put some sort of detection in the script so that when it runs twice you can detect how it is running, and respond appropriately.


              Something like Get(AccountName) could detect if you’re arriving before a specific login took place.


              Or in your case you could also use:

              IsEmpty( $variable )

              1 of 1 people found this helpful
              • 4. Re: Webdirect call a script twice ??

                "Signing in with HTTP POST" sounds very interesting.  Do you have example html code on how this is done?  I am wondering if this makes it possible to run scripts in web direct from a webviewer without it logging the user out and requiring them to login again on password protected web direct databases?

                • 5. Re: Webdirect call a script twice ??

                  1) Webdirect can not be run from a webviewer, this is why: Same-origin policy - Web security | MDN


                  2) I do not have example code, but please read the FMS16 WebDirect Guide which covers the expected POST parameters: FileMaker 16 WebDirect Guide


                  3) Not sure what you're trying to do, if you just need to run scripts on a database from a website, why not use the PHP API, that supports the execution of scripts. Rather than WebDirect. If you do not need the full filemaker experience via the browser, I am not sure why you are using WebDirect.

                  1 of 1 people found this helpful
                  • 6. Re: Webdirect call a script twice ??

                    Thank you for the weblinks.  Webviewers in web direct can be used to make

                    dashboard reports by calculating the html to display,  Sometimes you want

                    links in the web viewer to run scripts in the database. They will run them

                    in webdirect fine if it is not a password controlled database but if it is

                    a password controlled database, it logs out of the database and brings you

                    to the login screen to run them.  The FileMaker documentation doesn't seem

                    to do an example of logging in with an http post to web direct, it just

                    says you can do it. I was wishing that meant there was some html code you

                    could calculate in the web viewer to run scripts in the webdirect database

                    for the user using them like drill down to the dashboard report summary so

                    they could see the individual records and cool things like that.  I can do

                    this fine from FileMaker pro but my web direct users just get logged out

                    when they try to do it, which is kind of frustrating.