How do I get the domain name from a subdomain?
Like:
URL -> Output
m.gigabyte.com -> gigabyte.com
forums.localhost -> localhost
I have tried:
var domain = window.location.host.split( '.' );
window.location = 'http://' + domain[1] + domain[2] + window.location.pathname;
But it doesn't seem to work on localhost. I just want to strip off the subdomain and not the .com, .org, .net
's anymore...