SQL PHP HTML ASP JavaScript articles and free scripts to download If you are facing any problem in viewing this page, please tell us
 

document.domain of a page


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.


document.domain


The output for this page will be

www.plus2net.com

Here is the code.

<html>
<head>
<title></title>
<script type="text/javascript">
document.write(document.domain);
</script>
</head>
<body>


</body>
</html>



Further readings
referrer: Getting the referrer of the browser to know how the visitor has arrived
title: Managing the title of the page
url: Collecting the full script path or URL by document object
lastModified: Last Modified date & time of the file or page
domain: domain name of the URL or site using this script
write: sening output text to browser by using document.write


Sections
PHP
JavaScript
ASP
HTML
SQL
Photoshop
Articles SEO
Document Object
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.