Skip to content

Commit

Permalink
Merge pull request #53 from GoogleChromeLabs/docs-fragment
Browse files Browse the repository at this point in the history
docs(README): add URL fragments note about ignores (#52, #49)
  • Loading branch information
addyosmani committed Dec 17, 2018
2 parents 02778df + 95ee730 commit 41e70af
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -196,6 +196,20 @@ quicklink({
});
```

You may also wish to ignore prefetches to URLs which contain a URL fragment (e.g. `index.html#top`). This can be useful if you (1) are using anchors to headings in a page or (2) have URL fragments setup for a single-page application, and which to avoid firing prefetches for similar URLs.

Using `ignores` this can be achieved as follows:

```js
quicklink({
ignores: [
uri => uri.includes('#')
// or RegExp: /#(.+)/
// or element matching: (uri, elem) => !!elem.hash
]
});
```

## Browser support

The prefetching provided by `quicklink` can be viewed as a [progressive enhancement](https://www.smashingmagazine.com/2009/04/progressive-enhancement-what-it-is-and-how-to-use-it/). Cross-browser support is as follows:
Expand Down

0 comments on commit 41e70af

Please sign in to comment.