instantpage / instant.page

Make your site’s pages instant in 1 minute and improve your conversion rate by 1%
https://instant.page
MIT License
6.01k stars 206 forks source link

dns-prefetch or preconnect on hover for external links [when allow-external disabled] #90

Open lrehmann opened 3 years ago

lrehmann commented 3 years ago

It isn't always appropriate to enable 'allow-external', however, some optimizations can still be made for external links by requesting the browser prefetch the dns records or preconnect to the host. Twitter has enabled such a service while hovering over tweets to external urls. fcc gov-twitter-preconnect

I would like to propose adding a flag for 'external-preconnect' and appending dns-prefetch or preconnect html tags when a user hovers or begins to click off-domain url.

<link rel="preconnect" href="https://example.com">
<link rel="dns-prefetch" href="https://example.com">
dieulot commented 1 year ago

That’s something I’d like to do.

I know that Chrome, at least, already do similar things automatically, so I'll need to investigate to learn what’s useful and what’s redundant. I’m guessing browsers wouldn’t go farther than prefetching DNS, especially on mobile, so I’m hopeful a JavaScript solution can help via preconnect.