4 ms·
Generally, the best way to handle this is using the public suffix list: https://publicsuffix.org/ https://publicsuffix.org/ org.hk is an entry in it, which mea
by Deimorz 7y ago
Generally, the best way to handle this is using the public suffix list: https://publicsuffix.org/ https://publicsuffix.org/
org.hk is an entry in it, which means you should display the next section "up" from that, so that would be hkispa.org.hk as wanted here.
- peteretep 7y agoThe public suffix doesn't list .ac.uk or .go.th (because it only lists somewhere the general public can register) so it's not especially useful for working out if something is a toppish-level domain.
- acrispino 7y agoWhat's a useful method to do that?
- peteretep 7y agoNo idea for how you’d generate an exhaustive list, although one-off you could walk up a given URL’s host looking for A-records? You’d want some fail-safes there presumably. Perhaps you could do this with the common crawl db
- breakingcups 7y agoJust in case you didn't catch the other message, the public suffix list does in fact include the domains mentioned.
- Deimorz 7y agoIt includes both ac.uk and go.th. ac.uk: https://github.com/publicsuffix/list/blob/master/public_suffix_list.dat#L6380 https://github.com/publicsuffix/list/blob/master/public_suff... go.th: https://github.com/publicsuffix/list/blob/master/public_suffix_list.dat#L6120 https://github.com/publicsuffix/list/blob/master/public_suff...
- peteretep 7y agoYou're right, apologies. I was Ctrl-F'ing with a leading dot.
- wereHamster 7y agoThe list doesn't only specify which domains users can register, but it is also used by browsers to determine what constitutes "same origin". This is related to security so even registrars which don't allow the general public to register these domains, it is very much in their interest to add an entry to the public suffix list. For example, the maintainers of .ac.uk should very much care about the owner of "foo.ac.uk" not being able to set a cookie for "bar.ac.uk", which is partly what the PLS is used for!