Object with configuration for prefetch function
Sets the body of prefetch request.
Allows to change default CORS policy of prefetch request. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
Allows to override the default forcePrefetchRatio value from install() function. The number represents ratio of requests that are sent to origin even when they are not in the Edge cache. Possible values: Number between 0 and 1. Number 0 is equal to 0% requests and 1 to 100% requests sent to origin.
Allows to override the default includeCacheMisses value from install() function. Set to true to send all requests to origin even when they are not in the Edge cache.
Allows to override the default Prefetch TTL or serviceWorkerSeconds value defined in routes.js. The number represents the seconds for how long the item will be stored in the browser cache.
Allows to change default HTTP GET method of prefetch request.
Configures prefetching options
Adds the query param that indicates to the service worker that a request may be throttled
Prefetches and caches the specified URL.
Example
import { prefetch } from '@edgio/prefetch/window
// Prefetches the URL with default PrefetchConfiguration
prefetch('/some/url')
// Prefetches the URL as fetch with custom PrefetchConfiguration
prefetch('/some/url', "fetch", {
// Overrides the default Prefetch TTL or serviceWorkerSeconds value defined in routes.js
maxAgeSeconds: 300, // 5 minutes
// Allows to override the default forcePrefetchRatio value from install() function
includeCacheMisses: true
});
The URL to prefetch
Value to use for the "as" attribute of the tag
Options to use for the prefetch
Returns true if the next prefetch request should only be served from the edge cache. This is done by comparing a random number between 0 and 1 to options.forcePrefetchRatio
Generated using TypeDoc
Possible values for the "as" param of prefetch function https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as