Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

Simple Javascript help

Status
Not open for further replies.
Joined
May 23, 2005
Posts
2,036
Reaction score
50
Hiya I have

PHP:
<script>
document.write(window.location.hostname)
</script>

Which would display www.domain.com

but I would like to strip out the www. bit so it only displays domain.com

How would I do that.

Thanks
 
You should be able to use the replace function,

something like

document.write(window.location.hostname.replace(/www./i,''))
 
Status
Not open for further replies.

Rule #1: Be Respectful

Do not insult any other member. Be polite and do business. Thank you!

Premium Members

New Threads

Domain Forum Friends

Lastest Listings

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Siusaidh AcornBot:
    Siusaidh has left the room.
      Siusaidh AcornBot: Siusaidh has left the room.
      Top Bottom