Navigate between FileMaker and an app
Screen navigation within a Web Viewer app uses client-side JavaScript routing. When a user clicks an in-app button or link, the client-side router updates the view immediately without a network round trip to FileMaker.
This topic covers in-app routing and the methods used when FileMaker scripts trigger navigation. For startup route configuration, see Initial props. For hosting multiple entry points in a bundle, see Multiple apps.
Navigating from the app
Within the Web Viewer app, navigation operates through standard router links or programmatic navigate() calls. Hash-based routing stores the active route in window.location.hash, which preserves navigation state across page reloads without requiring server-side routing support.
Navigating from FileMaker
A FileMaker script can also navigate the user to another view. Depending on the target destination, use one of the following approaches:
Navigating to a FileMaker layout
If the destination is a native FileMaker layout outside the Web Viewer, trigger a FileMaker script from JavaScript using callFMScript:
callFMScript(
"Navigate Away From Web Viewer",
{ layout: "Contacts" },
FMScriptOption.RESUME,
);
See Call FileMaker scripts from an app for details on asynchronous script execution.
Navigating to an in-app route from a script
If the destination is an internal screen within the Web Viewer app, the FileMaker script must communicate into the running web client using a registered command:
export function CommandNavigation() {
const navigate = useNavigate();
useWebViewerCommand("openCustomer", (recordId) => {
navigate({ to: "/customers/$id", params: { id: recordId } });
});
return null;
}
To invoke the command from FileMaker, use the Perform JavaScript in Web Viewer script step:
Perform JavaScript in Web Viewer [ Object Name: "web" ; Function Name: "adk.openCustomer" ; Parameters: Customers::id ]
See Commands for complete command registration options, including the useWebViewerCommand hook and the static registerWebViewerCommand method.