instantpage/instant.page

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

lrehmann opened this issue · 1 comments

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">

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.