Results 1 to 2 of 2

Thread: Domain Name Script to detect what domain name the visitor is using

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2001
    Location
    HondaForums.com
    Posts
    11

    Domain Name Script to detect what domain name the visitor is using

    Ok, I think this is the correct forum to post in.

    Ok, I have one of those free domains at go.cc.
    I get a lot of traffic from that domain to my main domain mydomain.com. Now go.cc hides the main domain and doesn't release it. So, no matter where you browse on my website, the browser URL stays at my go.cc domain.

    I want my main domain page to be able to detect that the domain in the browser is not the main domain and break free from it and show the actual domain address. The reason being, is that I run Perl and CGI stuff and it is screwing up the logins.

    Thanks...

  2. #2
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Hi,

    you can use this client-side Javascript check I wrote a while ago.

    Code:
    function findDomain(domainName){
      if (document.location.href.indexOf(domainName)!=-1){
          return true;
      }else{
          return false;
      }
    }
    Put this in the <body onload> event...

    Code:
    if (findDomain("go.cc")==true){document.location.href="newdomain.com";}
    ... It basically checks to see if the domain name exists in the URL and returns true/false depending on whether it does. Then it redirects them to your real domain (newdomain.com in my example).
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width