How to show domain name in HTML or PHP

If you need to show the domain name in a HTML page, you can do it using following javascript code:

<p>the domain <script type="text/javascript">

document.write(document.domain);

</script> is registered</p>





Using php instead you can use following code:

<p>the domain<?php echo $_SERVER['HTTP_HOST'] ?><br> is registered</p>

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What do I need to do to put Flash on my website?

Flash is a client side feature - it runs on the user's computer, not on your web host. As long as...

What are private nameservers and how do I set them up?

Private nameservers are where your domain points to our nameservers so that your customers do not...

Static IP vs. Dynamic IP Address

A static IP address is one that remains fixed and never changes. The PC always sees the same...

Protecting Yourself Against Viruses & Data Loss

It is vital to ensure your computer is protected from viruses and trojans. As well as...

How to Upgrade perl?

Run the following command. cd /usr/local/src ; wget...