Ad
Latest Review
Screenshot of the opening screen of Super Mario Bros. Wonder
November 5, 2023
Latest App Update
App icon for wwriteLite
August 1, 2023

Blocking the .zip Top Level Domain with an iOS Content Blocker

Screenshot of Safari blocking the URL 'win.zip' using a content blocker.

A few years ago Apple introduced the ability for a new type of application, content blockers. Content blockers are aptly named in that they will help you block content on the internet. The reason why you may want to block content can vary, and content blockers can help allow you to block exactly what you want to block.

The file format for the data for a content blocker is JSON. Each entry consists of two parts, a "trigger" and an "action".

Google has recently made a few new top-level domains, or TLDs, available for registration. The two problematic ones are ".zip", and ".mov". Bleeping Computer has a good write up on how these could be used in a malicious nature to trick users into visiting a site where they can get infected. The issue with these domains, as opposed to other domains, is that the ".zip" and ".mov" extensions are used as file type extensions and this could be the cause of confusion.

If you want to block a top level domain you can use the following code to block .zip domains, but still be able to download .zip files from other sites.

{
    "trigger": {
            "url-filter": ".*\.zip\/"
    },
    "action": {
        "type": "block",
    }
}

The reason that .zip domains are blocked, but files work is due to the " / " in the "url-filter". The ".zip" will match .zip domains. Domains will have a trailing forward slash, whereas files will not. The "url-filter" trigger above will match the trailing slash.

I am not sure how many people will do this, but I am providing the code should anyone want to block the .zip, or .mov top level domains.

For more information about content blockers be sure to check out Apple’s documentation site.

Tags: