We reported an interesting detail last night. Users reported online that YouTube’s loading speed slowed down when using the Firefox browser. Curiously, if you use a user agent (UA) switch to trick the browser into thinking it's Google Chrome, YouTube will load very quickly.


This behavior was primarily discovered by Reddit users, and while it appears to be a performance optimization issue, or a lack of performance optimization by the Mozilla Firefox development team, eagle-eyed users noticed a 5000 millisecond or 5 second delay in sections of the code that seemed to have been put there intentionally for some reason.

When asked to comment on the matter, Google provided the following statement:

To support a diverse ecosystem of creators around the world and give billions of people access to the content they love on YouTube, we’ve begun efforts to urge viewers who have ad blockers enabled to allow ads on YouTube, or to try YouTube Premium for an ad-free experience. Users who have an ad blocker installed may experience suboptimal viewing regardless of the browser they use.

Therefore, according to Google, the delay is due to having an ad blocker installed, resulting in a "sub-optimal viewing" experience. Interestingly, the tech giant further added that this happens "regardless of the browser a user is using," suggesting that it's not just the Firefox browser that's affected.

It seems like there's more to the problem than that, because at first glance, most people would think there's something fishy going on here, especially since tricking the Chrome browser seems to be working. And there is obviously a reason for this.

Another Redditor, frisch85, took a closer look at the suspicious code, and the results seemed to closely match the claims provided by Google. He explained:

I checked part of the referenced code and suspect this is related to Firefox as the user agent is not checked when executing this code and it looks more like the ad itself. This seems to me more like a lazy attempt to make sure the ad is shown for at least 5 seconds before the actual video loads, rather than doing anything shady.

Why does it load slowly the first time instead of every time? Quite simply, instead of reloading the page like we'd expect, YouTube prevents you from reloading the entire page but reloads the content without reloading all the scripts, which is what some sites do these days and I don't really like it because it loads faster but isn't really a reload.

So the instances where YouTube runs perfectly on Chrome, but struggles on Firefox, may have more to do with the way YouTube itself "reloads" than some trickery.

Related articles:

The performance of browsing and playing YouTube pages in Firefox seems to have been deliberately weakened