SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: referrer's url

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Location
    D¨n ╔ideann, Alba
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, while i know how to get the domain of the referrer (i.e. document.referrer), I don't know how to get the entire URL of the referrer.

    Does any1 have an idea as to how this might be done?

    Cheers. Scot-bot.

  2. #2
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    document.referrer should give you the full URL, not just the domain name. Do you have an example that is doing otherwise?

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Location
    D¨n ╔ideann, Alba
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm working off a local copy of IIS, so when I say alert(document.referrer) it returns the domain only, which happens to be set-up as the name of my PC.

    Is it possible to get the url of the last page visited in the history, whether it was forward or back in it?

    Cheers. Scot-Bot.

  4. #4
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you use ASP, you can use:
    Code:
    <%Request.ServerVariables("HTTP_REFERRER")%>
    ASP Rocks.

    I know this is the client-side forum, but it's so easy with ASP. Hope this helped anyways!
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  5. #5
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aha, a local copy. I've seen document.referrer not work when browsing files locally, but when uploaded to a remote web server, it works. My local machine is also running IIS, but it still won't show the referrer until I upload my files. If possible, see if it makes any difference. Not sure why this happens.

    Other than that, it should show the full URL of the page visited before landing on your page with document.referrer in it. You can't dig into the user's history, for security reasons.

  6. #6
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Location
    D¨n ╔ideann, Alba
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx for the tips, guys. Unfortunately, though I'm using IIS to develop the site, the site will in the end run on an Apache-Solaris server.

    I'm only using Microsoft because I'm more comfortable with it than Unix. So, I can't use ASP to solve the problem: the other web-developer is doing all that nasty Perl/CGI stuff. I can't even do any SSJS .

    Ta, anyway. Scot-Bot.


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
  •