| Written by


Testing my iPhone Domain Manager I came across an error, of the show stopper variety. Like all good developers I created a set of test criteria that the application had to pass before I submitted it to the App Store. One of those criteria was the ability to produce search results for the 5 most popular Top Level Domains (TLDs) – .com, .cn, .de, .net and .uk.

The Problem

As it turns out .uk sites fail with the Domain Manager. How come? Because during development I overlooked Second Level Domains (SLDs.) When someone enters in a website like meta.stackoverflow.com I strip out the meta subdomain because there isn’t a Whois record for that subdomain. However, when I tested a site like bbc.co.uk this strategy fails and only ever returns co.uk. As a result huge sites like guardian.co.uk and amazon.co.uk don’t work. Ooops!

Finding a Solution

I figured that there shouldn’t be that many SLDs, I could do some string matching and allow sites with valid SLDs to pass through my subdomain stipper. I did a quick search and was unable to find an SLD list. So I jiffied up some code using the HtmlAgilityPack (an amazing piece of code) to grab all the SLDs from wikipedia. As it turns out there are some 1000+ SLDs which pretty invalidated my solution.

Something from Nothing

I took a different path and ended up solving the subdomain problem, but I was left with this list of SLDs. Since nothing like it seems to exist on the net, why not give it away? So for those of you who need a list of SLDs, I’ve released an open source CSV list of Second Level Domains on Google Code. Hope this saves you some time and effort!

  • Anton Melser

    Thanks mate, this saved me from doing it!