GoogleChromeLabs / quicklink

⚡️Faster subsequent page-loads by prefetching in-viewport links during idle time
https://getquick.link
Apache License 2.0
11.02k stars 403 forks source link

Do not preload links (with anchors) to same site I am already on #52

Closed janpio closed 5 years ago

janpio commented 5 years ago

I added quicklink to a play project of mine, https://ionic.zone.

On https://ionic.zone/content, I have a table of contents with loads of page internal links with an anchor (#anchor) to headlines below. It looks like quicklinks tried to preload all of those:

image

Wouldn't it make sense to not preload links to the page I am already viewing?

addyosmani commented 5 years ago

One way to solve this is using the new ignores field which supports specifying a RegExp, Array or function of criteria to not prefetch URLs. You could set it to not prefetch any URLs with a anchor/fragment.

Related is https://github.com/GoogleChromeLabs/quicklink/pull/49

addyosmani commented 5 years ago

We've added a note in the docs around how to use ignores to ignore anchors and URL fragments that can now be found here https://github.com/GoogleChromeLabs/quicklink#custom-ignore-patterns. Hopefully that helps ❤️

janpio commented 5 years ago

Thanks. Can I limit that to the local domain? (So only # links for my own domain are ignored)