Responses
An overview of SPF responses and how they are processed.
In dynamic navigation, SPF updates the page with content from the response. SPF will do this processing in the following order:
title
— Update document titleurl
— Update document URLhead
— Install early JS and CSSattr
— Set element attributesbody
— Set element content and install JS and CSSfoot
— Install late JS and CSS
Note: All fields are optional and the commonly needed response values are
title
,head
,body
, andfoot
.
A response is typically in the following format:
{
"title": "Page Title",
"head":
"<style>CSS Text</style>
<!-- and/or -->
<link href=\"CSS URL\" rel=\"stylesheet\">
...",
"body": {
"DOM ID 1": "HTML Text...",
"DOM ID 2": "..."
},
"foot":
"<script>JS Text</script>
<!-- and/or -->
<script src=\"JS URL\"></script>
..."
}
This pattern follows the general good practice of "styles in the head, scripts at the end of the body". The "foot" field represents the "end of the body" section without requiring developers to create an explicit element.
To update specific element attributes, the response format is as follows:
{
"attr": {
"DOM ID 1": {
"Name 1": "Value 1",
"Name 2": "Value 2"
},
"DOM ID 2": {
"...": "..."
}
}
}