Skip to content

Instantly share code, notes, and snippets.

View vogtm's full-sized avatar

Matthias Vogt vogtm

View GitHub Profile
@PaulKinlan
PaulKinlan / prefetchbuilder.js
Last active September 9, 2023 06:09
Code to return link rel=dnsprefetch
(function() {
var requests = window.performance.getEntries();
var hosts = {};
var output = "";
for(var requestIdx = 0; requestIdx < requests.length; requestIdx++) {
var request = requests[requestIdx];
var origin = new URL(request.name).origin;
hosts[origin] = 1;