01 Dec 2022
Syncing UBLock Origin Filters Across Devices and Browsers
“The Not-quite-but-nearly-Easy Way”

If you’re anything like me --and why would you be? That would be creepy!-- then you despise adverts with every fibre of your being. So much so that you can’t imagine even using the intarwebs, without the uBlock Origin plugin installed on all your browsers.

Image credit: Dall-E…​ for those times when you can’t be arsed!

I’m not going to bother explaining what uBlock Origin is. If need it, you’ll already be using it, or will discover it for yourself at some stage. If you don’t need it, then you won’t care what it is. And probably aren’t even reading this anyway.

There is one major problem with uBlock Origin though [henceforth referred to as 'UBO' to save me typing].

If you use a range of different browsers across different devices, you need to tediously copy/paste any filters you have created into each browser in turn, to keep everything synced.

Now, UBO has a 'Cloud Storage' feature, available in the extension settings…​


which does allow you to sync the extension’s settings. However, this works through your browser’s built-in sync facility. So is no good if you occasionally use other browsers, or use different browsers on different devices…​


In my case, I mainly use Firefox on my computers and Yandex on my Android devices. I also occasionally use a Chrome-based browser on computer when Firefox won’t render a site properly. So I had been copy/pasting my filters across from one browser to another and from one platform to another, to try and keep everything in sync. Which, as you can imagine, is a bit of an arse, given that there is no 'master copy' and each UBO instance will contain and/or be lacking items found in the other instances.

Anyway, the other day I had a [very belated] 'Duh! moment'.

UBO can subscribe to online filter lists. There is a long list of these in the 'Filter Lists' tab of the settings, which you can choose to subscribe to. And UBO periodically polls these online filter lists and downloads updated versions. Don’t ask me how often it does this. I’m not sure…​


So, I had a brainwave: Why not save my UBO filters online somewhere and then subscribe to my own filter list. That way I’d only need to update my filters in one place and they automatically sync across UBO on all my browsers and platforms!

There was a slight negative side to this too, though. Most of UBO’s pre-supplied online filter lists are stored on Github as Gists. So, in order to maintain those lists, I’d have to set up a Github Gist and then push changes to it, every time I wanted to add a new filter. That would be slightly less hassle than just copy/pasting the new filter across to all my devices. But not much less.

What would be better would be if I could keep the filter list locally [on my laptop or mobile device], edit it locally and then have it automatically sync to somewhere online. The obvious choice was to use a document saved in Google Drive.

So I created a .txt file in my Google Drive folder and copy pasted my UBO filter rules into it. I also set the access to public…​


You can either do this on your Google Drive webpage, or by CTRL+clicking on the file in the Finder and selecting 'Share with Google Drive', whereupon you’ll get a dialogue allowing you to set the access permissions…​


Using the 'Copy Link' button on the resulting dialogue, I got a link with the following format:


where XXXXXXXXXXXXXXXXXXXXX represents the string of characters Google Drive uses to identify that document. I plugged that URL into UBO via the Import button at the bottom of the Filter Lists page…​


Then hit 'Apply Changes', followed by 'Update Now'…​


Unfortunately that didn’t work. As you can see from the red broken chain icon UBO has thrown up, it wasn’t able to parse the link…​


Thinking about it, that made sense. Although my file was a .txt file, it was being wrapped in the Google Docs interface…​.


what I wanted was a URL which linked to that actual raw data of my filters .txt file.

Tracking that down [as is often the case with Google, who change their APIs like other people change their underpants] turned out to be a rabbit hole exploring expedition. I tried about three supposed suggestions which I found on the nerdier corners of the intarwebs. None of which worked, before I stumbled upon the magic formula, buried deep in a Stack Overflow post, linked to from another Stack Overflow thread, which I’d got to in turn from yet another Stack Overfl…​ Well, you get the idea.

Anyway, the magic formula was this:


with the XXXXXXXXXXXXXXXXXXXX again being the file ID from before. Putting that URL into UBO’s Filter Lists settings and hitting 'Apply Changes' worked a treat. I didn’t even have to use the 'Update Now' button this time. UBO downloaded my filter list straight away…​


So, until Google changes their API again and breaks it, I now have a single source for all my UBO custom filters which should [update interval dependent] sync across all my devices, browsers and platforms --Hurrah!

Now all I need is to find a way to perform a similar feat with my UBO 'Rules'…​ which don’t seem to be similarly equipped to load from an online source.

Back to Top