fix(nuxt): preload links with same hostname

This commit is contained in:
Daniel Roe 2024-05-07 15:20:24 +01:00
parent 8bdd620ba1
commit c065505e1b
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -23,8 +23,8 @@ export default defineNuxtPlugin({
onNuxtReady(() => {
// Load payload into cache
nuxtApp.hooks.hook('link:prefetch', async (url) => {
const { protocol } = new URL(url, window.location.href)
if (!protocol) {
const { hostname } = new URL(url, window.location.href)
if (hostname === window.location.hostname) {
await loadPayload(url)
}
})