Skip to content

Commit

Permalink
Add loading="lazy" to iframe (#383)
Browse files Browse the repository at this point in the history
Lazy loads the utterances iframe
  • Loading branch information
techboyg5 committed Nov 14, 2020
1 parent 23860d6 commit 7ab9cd9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const url = `${utterancesOrigin}/utterances.html`;
script.insertAdjacentHTML(
'afterend',
`<div class="utterances">
<iframe class="utterances-frame" title="Comments" scrolling="no" src="${url}?${param(attrs)}"></iframe>
<iframe class="utterances-frame" title="Comments" scrolling="no" src="${url}?${param(attrs)}" loading="lazy"></iframe>
</div>`);
const container = script.nextElementSibling as HTMLDivElement;
script.parentElement!.removeChild(script);
Expand Down

0 comments on commit 7ab9cd9

Please sign in to comment.