Re: How to tell referrer in HTML?

Discussion in 'HTML' started by Jonathan N. Little, May 2, 2012.

  1. Joey@still_Learning.invalid wrote:
    > I have a link from one domain (A) to another (B). Both are on the same
    > server. When a visitor goes to B by clicking a link on A, how can B know
    > or tell it was referred by A?


    You cannot with HTML, it requires client-side JavaScript or server-side
    scripting* However the Referrer can be blocked|masked by proxy or
    security software.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, May 2, 2012
    #1
    1. Advertising

  2. Joey@still_Learning.invalid wrote:
    > Jonathan N. Little wrote:
    >
    >> Joey@still_Learning.invalid wrote:
    >>> I have a link from one domain (A) to another (B). Both are on the same
    >>> server. When a visitor goes to B by clicking a link on A, how can B know
    >>> or tell it was referred by A?

    >>
    >> You cannot with HTML, it requires client-side JavaScript or server-side
    >> scripting* However the Referrer can be blocked|masked by proxy or
    >> security software.

    >
    > Thanks. I ended up using js (document.referrer).


    Just as I pointed out previously, do not rely on the referrer. There are
    so many ways that it will not work. With JavaScript the client can have
    it disabled (and maybe not by choice) for one. So if this referrer
    sniffing is *required* to access your site you may be blocking
    legitimate visitors.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, May 3, 2012
    #2
    1. Advertising

  3. 2012-05-03 4:24, Joey@still_Learning.invalid wrote:

    > Before arriving at the page, the site determines whether the visitor has
    > js and cookies enabled. If not, the visitor is treated to a different
    > page.


    How would that happen? You cannot detect server-side whether the client
    has JavaScript enabled. So do you mean that you use client-side
    JavaScript to redirect to another page if JavaScript is disabled?
    There's something that doesn't quite work in that scenario. :)

    Maybe you meant to say that the page itself has content suitable for
    non-JavaScript non-cookies access and that it redirects to different
    page with JavaScript if cookies are allowed. That would work.

    But a more natural and a more robust approach is to use server-side code
    to check for the presence of a Referer field in the HTTP request. If it
    is present and its value is the address A, you can treat the visitor as
    coming from A and serve content according to that. No JavaScript needed,
    no cookies needed. If the user has disabled the sending of Referer or
    made the browser send a different Referer, then he should be treated as
    not coming from A; he has clearly expressed his wish of being treated
    that way.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, May 3, 2012
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Harley

    Get referrer URL

    Harley, Jul 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,022
    Harley
    Jul 24, 2003
  2. Harley

    Re: Get referrer URL

    Harley, Jul 26, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    3,277
    Harley
    Jul 26, 2003
  3. Aaron

    html referrer spoofing

    Aaron, Jan 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    5,955
    Chris Jackson
    Jan 26, 2004
  4. yogesh
    Replies:
    1
    Views:
    359
    Victor Bazarov
    Mar 14, 2007
  5. Mike A
    Replies:
    17
    Views:
    254
    Dr John Stockton
    Nov 19, 2003
Loading...

Share This Page