File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ function prefetcher(url) {
4848 * @param {Array } options.urls - Array of URLs to prefetch (override)
4949 * @param {Object } options.el - DOM element to prefetch in-viewport links of
5050 * @param {Boolean } options.priority - Attempt higher priority fetch (low or high)
51+ * @param {Boolean } options.sameOrigin - Restrict prefetching to assets with same origin.
5152 * @param {Array } options.origins - Allowed origins to prefetch (empty allows all)
5253 * @param {Number } options.timeout - Timeout after which prefetching will occur
5354 * @param {function } options.timeoutFn - Custom timeout function
@@ -62,7 +63,7 @@ export default function (options) {
6263
6364 observer . priority = options . priority ;
6465
65- const allowed = options . origins || [ ] ;
66+ const allowed = options . sameOrigin ? [ location . hostname ] : options . origins || [ ] ;
6667
6768 options . timeoutFn ( ( ) => {
6869 // If URLs are given, prefetch them.
You can’t perform that action at this time.
0 commit comments