JavaScript Tips

Buy this website for $5000 USD

Priced to sell, this is an established JavaScript website, growing in popularity as evidenced by its Alex ranking. Includes most website content. The price is NON-NEGOTIABLE. Serious buyers should contact

Obtaining the Domain Name

In JavaScript, you can retrieve the domain name of the current web page with the domain property of the document object. The document.domain property contains a string which contains the domain, including the "www" prefix if it's present in the URL, and the domain extension, such as "com", if a domain extension is present in the URL. The extension won't be present in the URL if the URL specifies a local server. The prefix, domain, and extension are separated by period characters.

The method below, writeDomain(), is used to write the current domain to this page. The current domain is:

function writeDomain()
{
   var myDomain = document.domain;

   document.write(myDomain);
}

Unfortunately, there is no way of obtaining the IP address with JavaScript.