Fastest way to grab domain/host name using javascript
<p>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. </p>

<p>Example:</p>

<p>input : <a href="http://stackoverflow.com/questions/ask">http://stackoverflow.com/questions/ask</a></p>

<p>result : stackoverflow.com</p>

<p>input : <a href="http://test.stackoverflow.com/questions/ask">http://test.stackoverflow.com/questions/ask</a></p>

<p>result : test.stackoverflow.com</p>

<p>I guess the best way to start is with document.location, but I'm at odds what to do from there. </p>
