#Using Prefetch in Svelte
1 messages · Page 1 of 1 (latest)
Hi @pale harness. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
The information extracts do not provide specific details about using data-astro-prefetch in a Svelte component. However, the data-astro-prefetch attribute is generally used with <a> links in your Astro site to opt-in to prefetching. When you hover over the link, the script will fetch the page in the background. This should work regardless of the JavaScript framework you are using, as long as the site is built with Astro.
Here is an example of how to use it:
<a href="/about" data-astro-prefetch>About</a>
Remember that prefetching only works for links within your site, and not external links.