Skip to content

Commit

Permalink
#464411 - Stop loading unused pubsub and prevent preloading header if…
Browse files Browse the repository at this point in the history
… is disabled.
  • Loading branch information
infloent committed May 28, 2024
1 parent c718c5d commit d6d46ca
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions head.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
});

const headerMeta = document.querySelector('meta[name="header"]');
const link = document.createElement('link');
link.setAttribute('rel', 'preload');
link.setAttribute('as', 'fetch');
link.setAttribute('crossorigin', 'anonymous');
const url = headerMeta?.content.trim();
link.href = url ? `${url}.plain.html` : 'header.plain.html';
document.head.appendChild(link);
if (url.toLowerCase() !== 'false') {
const link = document.createElement('link');
link.setAttribute('rel', 'preload');
link.setAttribute('as', 'fetch');
link.setAttribute('crossorigin', 'anonymous');
link.href = url ? `${url}.plain.html` : 'header.plain.html';
document.head.appendChild(link);
}
</script>
<style>body { display: none; }</style>
<link rel="stylesheet" href="/styles/styles.css" />
<script src="/scripts/pubsub.js" type="module"></script>
<script src="/scripts/component-base.js" type="module"></script>
<script src="/scripts/component-loader.js" type="module"></script>
<script src="/scripts/libs.js" type="module"></script>
Expand Down

0 comments on commit d6d46ca

Please sign in to comment.