SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jan 2004
    Location
    Nashville
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting Refferer Domain Name

    I would like to get the domain name (not URL) for the referer into a hidden form field to pass along with my PHP form.

  2. #2
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    document.referrer returns a string, you can use match to extract any part.


    function(){
    var M= (document.referrer)?
    document.referrer.match(/^(\w+\:\/\/)?(((\w+\.?))+)\//): '';

    return (M)? M[2]: '';
    }

  3. #3
    SitePoint Addict
    Join Date
    Jan 2004
    Location
    Nashville
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not a .js programmer person, just an end user. Perhaps you could contact me and I could offer to pay you to right the exact code I need?

    Gary


Bookmarks

Posting Permissions

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