Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Web viewer Javascript making FMP URL call back to same file (not hosted, non-iOS)

Featured Replies

In FMP 13.02 FileMaker apparently fixed the FMP URL for the desktop client, such that it could be used to make a call to the same/local/self file.  So I would have a web viewer in a solution and it would use an "fmp://web.address/dbname..." URL that would reference itself, the file that was currently open.

I found some references to how to do this, but for some reason things aren't working for me.  Apparently, if you are on a non-mobile platform, you need to use "$" as the IP address to reference the local file.  E.g. "fmp://web.address/dbname.fmp12?script=AScriptName&$var1=1234&$var2=abcd".  This would make the database essentially accept AJAX calls.  (Although an unanswered question for me is how does the response or data get back to the web viewer.  But for now, I just want to register event that trigger sending new data into the DB.)

Here's the code I am using for my web viewer definition.  The short description is that I am trying to integrate Full Calendar into a web viewer in a solution.  I am trying to configure the onDrag event so that when an event is modified it sends the new date range back to the DB.
-----------------------------


Let ( [     _IPDestination = If ( Left(Get(FilePath);7) = "fmnet:/"; Get ( HostIPAddress ) ; "$" ) ;     _fmpURLString = "fmp://" & _IPDestination & "/" & Get(FileName) & ".fmp12" ;     _fmScript1 = "?script=FullCalendarChangeDate";     $CurrDate = "2015/7/01"         //hardcoding for testing purposes ]; "data:text/html, <!DOCTYPE html> <html><head><meta charset='utf-8' /> <link rel='stylesheet' type='text/css' href='http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.3.1/fullcalendar.min.css'/> <script src='http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js'></script> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src='http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.3.1/fullcalendar.min.js'></script> <script>     $(document).ready(function() {         var   httpXHR, fmpurl ;         $('#calendar').fullCalendar({             defaultDate: '" & $CurrDate & "',             editable: true,             allDayDefault: true,             eventStartEditable: true,             eventDurationEditable: true,             dayClick: function() {                 alert('a day has been clicked!');             },             eventDrop: function(event, delta, revertFunc) {                 if (!confirm(event.title + ' was dropped on ' + event.start.format() + '.nAre you sure?')) {                     revertFunc();                 }             },             eventResize: function(event, delta, revertFunc) {                 if (!confirm(event.title + ' end is now ' + ( event.end.format() ) + '.nnIs this okay?')) {                     revertFunc();                 } else {                     fmpurl = '" & _fmpURLString & _fmScript1 & "&$eventid=' + event.id + '&$newEndDate=' + event.end ;                     httpXHR = new XMLHttpRequest();                                 httpXHR.open("GET", fmpurl, true);                 }             },             events:  [                 {                     id: 1,                     title: "Project 1",                     start: "7/1/2015",                     end: "7/3/2015"                 },                 {                     id: 2,                     title: "Project 2",                     start: "7/3/2015",                     end: "7/7/2015"                 },                 {                     id: 3,                     title: "Project 3",                     start: "7/7/2015",                     end: "7/7/2015"                 },                 {                     id: 4,                     title: "Project 4",                     start: "7/7/2015",                     end: "7/11/2015"                 },                 {                     id: 5,                     title: "Project 5",                     start: "7/14/2015",                     end: "7/16/2015"                 },                 {                     id: 6,                     title: "Project 6",                     start: "6/18/2015",                     end: "7/3/2015"                 },                 {                     id: 7,                     title: "Project 7",                     start: "7/30/2015",                     end: "8/15/2015"                 },                 {                     id: 15,                     title: "Project 15",                     start: "6/08/2015",                     end: "6/19/2015"                 }             ]         });             }); </script> <style>     body {         margin: 0;         padding: 0;         font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;         font-size: 14px;     }     #calendar {         width: 900px;         margin: 40px auto;     } </style></head> <body>     <div id='calendar'></div> </body> </html> " )

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

In the middle of that you will see these three lines, where I am trying to make that call back to the local file from the webviewer:

            fmpurl = '" & _fmpURLString & _fmScript1 & "&$eventid=' + event.id + '&$newEndDate=' + event.end ;
            httpXHR = new XMLHttpRequest();            
            httpXHR.open("GET", fmpurl, true);

Any one have experience achieving this?  Todd Geist's Watermark module uses this technique but I can't seem to extract that functionality for my own purposes here.  :)


Thanks,

-- Justin

 
  • Author

I heard back from Todd with some clarifications:

Apparently, you still can't use an XMLHTTPrequest directly to FM.  Some plugins may enable such functionality, but nothing natively handled at this time.

You can partially achieve this result (send-only, from webviewer to FM DB) via:  window.location = "http://a.url.com/database?script..."

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.