How to get the URL?

A

ASK

Hi,

I am new to Javascript.
I have registered 3 domain names (www.web-1.com , www.web-2.com and
www.web-3.com and all the 3 domain names points to same hosted
website. When someone browses my website using the URL
http://www.web-2.com then I want a welcome message as "Welcome to
web-2.com", when someone browses my website using the URL
http://www.web-3.com then I want a welcome message as "Welcome to
web-3.com".

How can I achive this because I will have to dynamically change the
welcome message? I am not interested in maintaining multiple pages.
Any solution?


ASK.
 
M

Michael Winter

[snip]
How can I achive this because I will have to dynamically change the
welcome message? I am not interested in maintaining multiple pages.
Any solution?

It would be best to do this server-side. However, window.location.href (or
just window.location) will retreive what you want.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top