197
rated 0 times
[
200]
[
3]
/ answers: 1 / hits: 30591
/ 15 Years ago, wed, august 5, 2009, 12:00:00
I already have quite a bit of js on my site, so I want to have a function that grabs the domain name of the current url as efficiently as possible.
Example:
input : https://stackoverflow.com/questions/ask
result : stackoverflow.com
input : http://test.stackoverflow.com/questions/ask
result : test.stackoverflow.com
I guess the best way to start is with document.location, but I'm at odds what to do from there.
More From » javascript