I want to get just the domain name(yahoo, google, stackoverflow) from the domain in javascript. How can I easily pull just this out and drop any subdomain and any extension?
See comment, I need it to work for any domain if possible.
I want to get just the domain name(yahoo, google, stackoverflow) from the domain in javascript. How can I easily pull just this out and drop any subdomain and any extension?
See comment, I need it to work for any domain if possible.
var domain = 'http://www.google.com/';
var parts = domain.toString().split('.'.toString());
parts[parts.length - 2];