Make any YouTube embed click-to-load using uBlock Origin

Martin Brinkmann
Apr 2, 2021

Part of YouTube's success comes from the fact that it is easy to embed YouTube videos on third-party sites. Many website owners publish YouTube videos on the site itself but also on their own sites, and others may embed YouTube videos by other creators on their sites.

It is convenient to supplement an article that you are writing with a video, either self-created or created by someone else. On the other hand, users who don't want to watch the video may still have it played outright on the site or at least loaded to a degree. Connections to YouTube may not be wanted because of privacy. Some web browsers come with options to control media playback, others offer limited functionality in this regard only.

If you are using the content blocker uBlock Origin, you may use it to turn any YouTube embeds on third-party sites into click-to-play widgets. The main benefit of doing so is that there won't be any connections to YouTube and that nothing will load from the site unless you interact with that widget.

Here is an example screenshot captured here on this site after making the change in uBlock Origin. Note that we use the nocookie version of YouTube embeds on this site only.

ublock origin click to load

A click on the widget loads the content; in this case just the YouTube video with options to start playback. On other sites, videos may play right away depending on factors such as the web browser that is used, the video in question, and the site.

The only downside to the approach is that you don't see the thumbnail or title of the video anymore on the page.

How to make YouTube embeds click-to-play in uBlock Origin

ublock origin youtube block embeds

It is actually very easy and can be done in just a minute. Here are the steps:

  1. Activate the uBlock Origin icon in the browser's toolbar and select the "open the dashboard" option to open the management dashboard.
  2. Switch to the "My filters" section when the page opens.
  3. Add the following two lines to the list of filters:
    • ||^$3p,frame,redirect=click2load.html
    • ||^$3p,frame,redirect=click2load.html
  4. Click on "apply changes" to save the new filters.

Once done, visit any site with YouTube embeds to test the filters. You can try our Vivaldi 2.10 review for example, as it includes a video embed.

Closing Words

Turning third-party embeds into click-to-play widgets is an excellent way of speeding up the loading of websites and improving privacy at the same time. Raymond Hill, the creator of uBlock Origin, published the tip on Twitter recently.

It should be easy enough to use the two filters as a blueprint for other third-party embeds that you encounter. All you have to do, usually, is replace the domain name of the site in question while leaving the instructions untouched.

Now You: do you prefer click to play or autoload?

Make any YouTube embed click-to-load using uBlock Origin
Article Name
Make any YouTube embed click-to-load using uBlock Origin
Find out how to make any YouTube embed on any third-party website click-to-play to improve loading performance and privacy using uBlock Origin.
Ghacks Technology News

Tutorials & Tips

Previous Post: «
Next Post: «


  1. Alex said on April 15, 2021 at 11:05 pm

    The “Video unavailable” is quite annoying. Is there a way around it?

  2. Dumbledalf said on April 5, 2021 at 9:31 am

    Just use AutoPlayStopper and all the videos regardless of their origin are in Click to Play mode. Works just as good on Kiwi on Android. Even Firefox on desktop does not have such an extension that works so well, they only work with YouTube and the built in auto play block is piss poor.

  3. Peterc said on April 2, 2021 at 11:29 pm

    Thanks, Martin. This tip may prove to be very helpful for me:

    I’m still barely holding on to Pale Moon as my default/primary browser, and YouTube (and Gmail) have been *killing* performance browser-wide for a while now, but *especially* in the last couple of weeks. Basically, we’re talking about *very* frequently recurring hangs that last from 3 to 15 seconds on *every* tab once a YouTube or Gmail tab has been loaded. The more offending tabs, the worse the problem. Moreover, the problem doesn’t go away when you close all of the offending tabs. Alphabet/Google apparently leaves some zombie blobs in RAM that keep f*cking things up and don’t get flushed until you restart the browser. The only solution is to never load YouTube (or Gmail) in Pale Moon. (I’m guessing that at least *some* other Alphabet/Google sites/services cause the same problem.)

    It’s only very recently that I definitively confirmed YouTube and Gmail as the source of my Pale-Moon hangs, and I don’t yet know whether *embedded* YouTube videos trigger them. But if they do, I now have a way to (hopefully) prevent them. I haven’t yet reached the point where I’m willing to block YouTube and Gmail scripting in eMatrix, but it may come to that if Alphabet/Google keeps screwing Pale Moon users and Pale Moon’s developers can’t find a way around it. I’ve already moved my Gmail and YouTube activity to Brave to the extent possible; we’ll see if I finally feel like I have to abandon Pale Moon entirely. If it comes to that, I will do so with *immense* regret, and I will place the blame squarely on Alphabet/Google.

    PS: Pale Moon has such a tiny user base that I doubt very much it is being deliberately targeted. However, it’s clear to me that Alphabet/Google is designing its sites and services for use via Google Chrome with little regard for other browsers and that an increasing number of other sites and services are following suit. When the owner of the dominant web browser, the dominant search service, the dominant video service, and the dominant email service has the dominant voice in the evolution of Web standards and protocols, that’s a serious antitrust problem that public enforcement authorities don’t seem to be willing to acknowledge. Sure, antitrust martinet Tim Wu was recently hired as “Special Assistant to the President for Technology and Competition Policy,” but have you ever heard the expression, “It’s better to have a critic inside the tent pissing out than outside the tent pissing in”? ;-)

    1. Peterc said on April 13, 2021 at 10:10 pm

      CORRECTION: For now, Gmail is *very badly affected* by hangs caused by *YouTube*, but Gmail itself does not appear to be an independent source of problems. So long as I never load YouTube in Pale Moon, Gmail appears to run trouble-free. I still stand behind all the bad things I wrote about YouTube in Pale Moon. And about Alphabet/Google. And about tents. ;-)

      1. Peterc said on April 29, 2021 at 7:40 pm

        UPDATE: Since disabling eMatrix for the entire YouTube scope, I’m no longer getting hangs, lags, and typing dropouts after loading YouTube tabs in Pale Moon. The partially irreversible memory bloat continues, albeit more slowly, so there is still something about YouTube that is ill-behaved (inadequate marking of elements loaded in RAM for garbage collection when the tab is closed). Unfortunately, because Alphabet/Google continually runs experiments and changes behind-the-scenes coding/scripting in YouTube — witness how often youtube-dl breaks and has to be updated — it’s impossible (for *me*) to figure out whether the improvement is due to my eMatrix change or due to something YouTube did. I’ve seen YouTube problems get markedly worse for a while and then get better for a while over the past year, with no action whatsoever on my part. For now, I can once again load YouTube in Pale Moon and I don’t have to restart as often to flush accumulated uncollected YouTube garbage from RAM, so I’m reasonably happy. The only sites I *have* to load in Brave are back to Netflix and the odd other incompatible site. I *still* think YouTube is a *bad actor* where coding for non-Chrome browsers is concerned, single-process browsers in particular. (When you assume everything spawned by a tab will be flushed when the tab’s individual process is killed, why bother properly marking garbage for collection? After all, it doesn’t affect Chrome.)

  4. BM said on April 2, 2021 at 8:28 pm

    With uMatrix, I CTRL-Click the YouTube link to open in new tab – full browser mode.

    If I want more controls, I click on the word “YOUTUBE” on the bottom right of the screen to open in YouTube proper – this shows the smaller screen for playback, and missing playback controls, plus the description, comments and recommended videos down the right.

    BTW, I’ll give a plug for the Enhancer for YouTube addon – can set it to force max quality and force faster playback – both of which I’d often change when watching new videos, and just got tired of doing so frequently.

  5. Tsami said on April 2, 2021 at 7:34 pm

    Thanks for this! I have avoided YouTube for years due to Google’s privacy intrusions; this will help to remove that issue.

  6. Tom Hawack said on April 2, 2021 at 12:17 pm

    This uBO filter has the advantages mentioned in the article and does work indeed, except that some videos require to be opened on YouTube and will refuse to be opened embedded, with the message :

    Video unavailable
    Watch on YouTube

    The site [] is adequate for testing embedded videos and includes YouTube, Vimeo, Dailymotion and more embedded urls to check one’s browser’s response to these embedded urls. Testing the YouTube embedded video happens to include a video which will require to be opened on [] in the non-embedded format. Generally speaking, some videos accept lo be opened in the embedded format, others not. In my experience those refusing embedded are a minority but when they occur it’s bothering of course.

    I have a script for toggling a YouTube video from ‘normal’ (watch) to embedded (embed) : []

    Convert it to a bookmarklet or insert it as I did to a mouse gesture extension supporting scripts such as Gesturfy and toggling can be performed with one mouse gesture, one.

    1. Tom Hawack said on April 2, 2021 at 12:30 pm

      EDIT : in the script I mention above ‘&WATCH’ is for my personal environment, useless otherwise, fixed script is :
      Sorry :=)

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.