You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-11Lines changed: 2 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,8 +80,7 @@ The above options are best for multi-page sites. Single-page apps have a few opt
80
80
*`timeout`: Integer for the `requestIdleCallback` timeout. A time in milliseconds by which the browser must execute prefetching. Defaults to 2 seconds.
81
81
*`timeoutFn`: Function for specifying a timeout. Defaults to `requestIdleCallback`. Can also be swapped out for a custom function like [networkIdleCallback](https://github.com/pastelsky/network-idle-callback) (see demos)
82
82
*`priority`: Boolean specifying preferred priority for fetches. Defaults to `false`. `true` will attempt to use the `fetch()` API where supported (rather than rel=prefetch)
83
-
*`sameOrigin`: Restricts prefetching to URLs of the same origin. Defaults to `false`. Any truthy value will ensure no cross-domain requests are sent & will override/ignore any `options.origins` value.
84
-
*`origins`: Static array of URL hostname strings that are allowed to be prefetched. Defaults to an empty array, which _allows all_ URLs to be prefetched.
83
+
*`origins`: Static array of URL hostname strings that are allowed to be prefetched. Defaults to the same domain origin, which prevents _any_ cross-origin requests.
85
84
86
85
TODO:
87
86
* Explore detecting file-extension of resources and using [rel=preload](https://w3c.github.io/preload/) for high priority fetches
@@ -141,17 +140,9 @@ Defaults to low-priority (`rel=prefetch` or XHR). For high-priority (`priority:
141
140
quicklink({ priority:true });
142
141
```
143
142
144
-
**Allow same-origin requests only**
145
-
146
-
Forcibly disables all cross-domain requests. All domains are allowed by default.
147
-
148
-
```js
149
-
quicklink({ sameOrigin:true });
150
-
```
151
-
152
143
**Specify a custom list of allowed origins**
153
144
154
-
Provide a list of hostnames that should be prefetch-able. All domains are allowed by default.
145
+
Provide a list of hostnames that should be prefetch-able. Only the same origin is allowed by default.
155
146
156
147
> **Important:** You must also include your own hostname!
0 commit comments