-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.domain() and Domain suffixes with two parts (i.e. co.uk) #17
Comments
I see your point. I must admit that I haven't thought about these xx.tld domains at all. Unless there is a table of second-level-domains (xx.tld), I wouldn't know how to make this happen. ( If anyone has any pointers, please let me know. |
A bit of research
still unclearis every SLD-enabled TLD prohibiting 'foo.uk' in favor of 'foo.co.uk' or are SLD (sometimes?) only a suggestion? If there's a black 'n white "doing SLD completely or not at all", we might inverse the process to scanning for TLDs not enabling SLDs (~150 vs 1400). But then "virtual TLDs" (e.g. ''.dev' used by me for local development infrastructure) wouldn't apply anymore. So, pretty much not an option (for me) either. damn. I'm certain I can convert that list of SLDs to some regexp and hook that into I'll have to think about this some more… |
Second Level Domains are now properly handled by URI.js Version 1.5.0 var uri = URI("http://www.example.co.uk")
uri.domain() // returns "example.co.uk"
uri.domain(true) // returns "co.uk"
uri.tld() // returns "co.uk"
uri.tld(true) // returns "uk"
uri.tld("co.il") // allowed, since it's a known SLD
uri.tld("foo.bar") // setting TLD to "bar" since "foo.bar" is unknown
I hope this helps… |
works as expected, i.e. this is awesome! Thanks alot for looking into it! |
Felt I should post this here since I've run into a similar issue.
The above code outputs |
Technically, URI.js is most likely returning the correct value, however I was wondering how the following issue could be resolved most elegantly:
... the value I was expecting was "amazon.co.uk".
So, whenever the suffix of a domain consists out of two parts (co.uk, com.tr)
domain()
returns a value which is not really expected/useful.Any help for how to treat these composed domain suffixes would be appreciated. Thanks.
The text was updated successfully, but these errors were encountered: