prefetchPageResources( )
Optimizes resource fetching of pages and lightboxes in the site so they will load faster.
Description
Use the prefetchPageResources()
function to optimize resource fetching of pages and
lightboxes you think your site visitors are likely to visit next. When the site
visitor navigates to those pages or lightboxes, they will load quicker than usual
since some of their resources have already been retrieved.
You can only prefetch resources from pages or lightboxes within the current site.
A prefetch is considered successful if the specified pages and lightboxes exist in the current site. If any of the specified pages or lightboxes do not exist, the prefetch operation returns an error status and lists of the pages and lightboxes that were not found.
Authorization
Request
This endpoint does not take any parameters
Response Object
Results of a prefetch.
NAME
TYPE
DESCRIPTION
A success or failure message.
The errors that occurred.
Status/Error Codes
Was this helpful?
1const response = wixSiteFrontend.prefetchPageResources( {2 "lightboxes": ["First Box", "Second Box"],3 "pages": ["/first-page", "/second-page"]4} );56if(response.errors) {7 // handle errors8}910/*11 * response is:12 *13 * {14 * "message": "success"15 * }16 */
1const response = wixSiteFrontend.prefetchPageResources( {2 "lightboxes": ["My Lightbox", "Fake Lightbox"],3 "pages": ["/my-page", "/nonexistent-page"]4} );56if(response.errors) {7 // handle errors8}910/*11 * response is:12 *13 * {14 * "message": "some resources not found",15 * "errors": {16 * "lightboxes": ["Fake Lightbox"],17 * "pages": ["/nonexistent-page"]18 * }19 * }20 */