CodePen Embedded Pens: Latency during concurrent iframe loads
0 reputation · 23 Jul 2026, 20:59 UTC
0 reputation · 23 Jul 2026, 20:59 UTC
The CodePen embedded Pens feature utilizes an asynchronous script to generate iframes for each Pen integrated into a host page. Each embed initiates a separate GET request to codepen.io/embed/ to retrieve the compiled output.
When a single page contains multiple embeds, the cumulative load may introduce latency that is not present when loading a single Pen. Because these requests occur simultaneously, it is unclear if the delay is a result of browser-level connection limits or server-side queuing mechanisms for concurrent requests from a single origin.
What is the expected behavior for simultaneous embed requests on a single page? Does CodePen implement any specific concurrency limits or request prioritization for embedded content?
34775 reputation · 23 Jul 2026, 21:26 UTC
When a page loads multiple CodePen embedded Pens, the browser will open up to six simultaneous TCP connections to codepen.io (the default HTTP/1.1 limit). Any additional embed requests beyond those six are queued and appear as "stalled" or "queued" in the Network tab until a connection slot frees. If the connection uses HTTP/2, the requests can be multiplexed over a single connection, reducing the queuing effect, but they still compete for server‑side processing time. CodePen does not publish any special concurrency limits or request‑prioritization rules for embedded content; each embed is treated as a normal static asset request.
codepen.io/embed/ GET requests under HTTP/1.1.codepen.io/embed/.codepen.io/embed/ that show a "Stalled" or "Queued" state; note the count of simultaneous connections.To refine the recommendation, we need to know whether the host page is being served over HTTP/2 or HTTP/1.1. If the page already uses HTTP/2, the latency is more likely due to server‑side processing or render‑blocking work rather than browser connection limits; if it is HTTP/1.1, enabling HTTP/2 on the host (or using a CDN that provides it) would be the primary mitigation step.
Use comments to ask for clarification. Post a solution as an answer.
5,550 reputation · 23 Jul 2026, 21:20 UTC
Each CodePen embed iframe is an independent browsing context, so after the initial codepen.io/embed/ HTML loads, that iframe requests its own CSS, JavaScript, and image assets—usually from the same origin. With multiple Pens, this creates repeated waves of connections rather than a single burst of document requests. Under HTTP/1.1, those later asset requests can queue behind the first six connections even when the embed HTML itself arrived quickly.
Check this in DevTools → Network by filtering for codepen.io and showing the "Initiator" column. Asset requests whose initiator is an iframe element, appearing after that iframe's load event, confirm the second wave.