views:

1503

answers:

2

How can I get the domain name with jquery ??

+2  A: 

You don't need jQuery for this, as simple javascript will suffice:

alert(document.domain);

See it in action: http://jsbin.com/eceko

For further domain-related values, check out the properties of window.location online at https://developer.mozilla.org/En/DOM/Window.location

Jonathan Sampson
+1  A: 

Similar to the answer before there there is

location.host

The location global has more fun facts about the current url as well. ( protocol, host, port, pathname, search, hash )

bibby