Updated for FileMaker 16, 17, 18: This article was originally published July 20, 2015. It has been modified to include newer versions of FileMaker, and older references for versions 14 & 15 were removed.
It turns out if you are using macOS you can get the same facilities found in Safari to debug your code that’s running in a FileMaker Web Viewer.
Enabling Web Inspector
To do this we need to first enable a hidden option. Quit any open copies of FileMaker and start up the Terminal app to execute one or more versions of the command below.
Quit FileMaker if open (it will overwite the plist change).
For FileMaker Pro 16 Advanced (Yes, advanced12 is correct for version 16):
defaults write com.filemaker.client.advanced12 WebKitDebugDeveloperExtrasEnabled -bool YES
For FileMaker Pro 16 and FileMaker Pro 17/18:
defaults write com.FileMaker.client.pro12 WebKitDebugDeveloperExtrasEnabled -bool YES
An important caveat with FileMaker 16 however is that the integrated/attached version will cause FileMaker Pro to crash when you quit. To avoid this, use the window mode buttons at top-left after the Inspector opens:
You can also try setting the Inspector’s default window mode, however this did not work consistently for us:
defaults write com.filemaker.client.advanced12 "__WebInspectorPageGroupLevel1__.WebKit2InspectorStartsAttached" 1
Using Web Inspector
A partial list of functions are:
- console.assert(expression, object)
- debug (expression)
None of these debugger functions will work until the Inspector has been activated, so enable it as soon as possible with the contextual menu on the Web Viewer. But at least the debugger breakpoints will persist each time the web viewer is reloaded.