I've been tasked to optimize a wordpress site (big surprise...) and found that Vimeo embeds duplicates of their player api js file. I would have thought the browser would prevent this but apparently it doesn't and it bogs down the site very bad. See image below. Any ideas on how to prevent this? I welcome programming suggestions, server settings, etc. I have no problem creating a plugin if need be. Thanks!

Edit: These videos are embedded, creating an iframe for each video. enter image description here

  • The browser is probably loading them from inside iframes, for which each has differing URLs, I don't think there's much you can do from the WP end of this, as it's more an issue with Vimeos site. However, there's no code in your question, and no information about how vimeo is even involved or loaded, I've just been assuming it's an OEmbed player inside post content – Tom J Nowell Dec 18 '18 at 18:05
  • You're absolutely right. They are embedded and the api creates an iFrame. There's nothing at all to be done when they're iframes? – LetTheWritersWrite Dec 18 '18 at 18:11
  • well the html that requests the player JS is being generated by a Vimeo server. You could try and prompt the browser to prefetch it, but now you're moving away from WP knowldge and towards generic PHP and HTML, or even Nginx/Apache depending how you implemented it – Tom J Nowell Dec 18 '18 at 18:17
  • I know PHP/Laravel better than I do wordpress lol. I think you're giving me the idea of simply embedding the vimeo videos into my own player to avoid all these api calls. Still can't believe they still use iframes. – LetTheWritersWrite Dec 18 '18 at 18:25
  • iframes are what most embeds are powered by these days, even Youtube uses iframes – Tom J Nowell Dec 18 '18 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.