If we are running a script in a website or in our localhost we can find out the domain name of the website by using document.domain property. Say we have developed a script which can work in multiple domains and we need to find out the present domain name for our processing.
Here is the syntax of our domain property of document object.
The output for this page will be
Here is the code.