Get The Current Domain Name With Javascript (Not the path, etc.) -


I plan to purchase two domain names for the same site. Based on which domain I'm planning to provide slightly different data on the page. Is there a way for me to find the actual domain name that is loading from the page, so I know how to change my content?

I have looked around for stuff like this but most of this is

  while using document.write (document.location)   

For example

Returns to

http://fiddle.jshell.net/_display/

i.e. the actual path or whatever.

How about:

    

location object actually refers to different parts of the URL

Comments