Script Function - fatsecret.setDefaultCanvasUrl(url)

Description

In the default configuration, the JavaScript API will load all canvas content into the container on the current canvas.
In some cases, it may be desirable to partition your application so that one or more of the application canvases are loaded into distinct containers embedded at distinct URLs.
Common scenarios for splitting the API across multiple URLs include:
  • Having a web page that provides a single entry point to the application showing the home canvas content and a dedicated web page for all subsequent canvas content that may use a different theme.
  • Providing a dedicated web page for authenticating users that redirects to your sites registration page as a hook to enable deep integration with your own profile database.
  • Manually loading sections of canvas content, or providing one or more web pages that make REST API calls to output a response to users.
fatsecret.setDefaultCanvasUrl is a directive to the application to load the content all canvases besides those explicitly nominated by fatsecret.setCanvasUrl to an alternate URL. If a user takes an action that requires that canvas content associated with an alternate URL to load, the state on the current canvas, together with information about the action to be taken is stored and the user is redirected to the alternate URL.

Parameters

Required

Name Type Description
url String The alternate URL for all canvas.

Example

Set an alternate URL for all canvases (see Manually Loading Content for more)
<script>
fatsecret.setDefaultCanvasUrl("http://www.example.com/home.html");
</script>
FatSecret Sites
For Developers

For Professionals

For Everyone

FatSecret Platform API

Support
API

About FatSecret

© 2021 FatSecret. All rights reserved.