![]() The code can be kind of verbose so I’ve setup a simple Embed Builder you can use the generate the code from a YouTube or Vimeo URL: ![]() ![]() This can even offer better performance than Lazy Loading, when you have to load videos above the fold, since there is no additional JavaScript required. Tip: If you want even better results you can remove the image entirely or replace it with an inline SVG image. View Page Run Results Now Src YouTube Embed Keep in mind these scores always vary based on network conditions and updates to Google Lighthouse itself, but should generally be similar to scores recorded at time of writing. Rather than just saying it’s better I’ve set up some demo pages so you can see the results yourself. Now this won’t give us a YouTube Video however it does let us link the video from within our iframe, then, when the link is clicked the full Embeddable YouTube page will be loaded. This attribute allows us to prefill an iframe with text and html instead of loading another page. There is a trick I like to call a Src Embed the uses a little known attribute for iframes called “srcdoc” Serve static assets with an efficient cache policy (For YouTube thumbnails).Does not use passive listeners to improve scrolling performance.Some third-party resources can be lazy loaded with a facade.Some common Lighthouse errors for YouTube include: When optimizing for PageSpeed with tools like Google Lighthouse it can be challenging to get all the parts optimized, but it can be especially frustrating when you’re being held back by a page you have no control of, such as a video embedded in an iframe. In this article we go through fixing YouTube Lighthouse issues using a Src Embed. ![]() How to fix Reduce unused JavaScript on YouTube Videos ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |