asp javascript HTTP_REFERER is or is not undefined?

Discussion in 'Javascript' started by Robert Mark Bram, Aug 2, 2004.

  1. Hi All!

    I have the following in an ASP script:

    var bounceBackPage = Request.ServerVariables("HTTP_REFERER");
    Response.Write("<p>bounceBackPage: " +
    bounceBackPage + ". Undefined? " +
    (bounceBackPage == "undefined") + " </p>");

    When I enter the page URL by itself, I expect HTTP_REFERER to be undefined..
    but this is the output I get:

    bounceBackPage: undefined. Undefined? false

    How can it print "undefined" and still return false for bounceBackPage ==
    "undefined"?

    Any advice would be most appreciated!

    Rob
    :)
     
    Robert Mark Bram, Aug 2, 2004
    #1
    1. Advertising

  2. Did this to solve my problem..

    bounceBackPage + "" == "undefined"
    which returns true.

    Rob
    :)


    "Robert Mark Bram" <none> wrote in message
    news:410e14b0$0$29782$...
    > Hi All!
    >
    > I have the following in an ASP script:
    >
    > var bounceBackPage = Request.ServerVariables("HTTP_REFERER");
    > Response.Write("<p>bounceBackPage: " +
    > bounceBackPage + ". Undefined? " +
    > (bounceBackPage == "undefined") + " </p>");
    >
    > When I enter the page URL by itself, I expect HTTP_REFERER to be

    undefined..
    > but this is the output I get:
    >
    > bounceBackPage: undefined. Undefined? false
    >
    > How can it print "undefined" and still return false for bounceBackPage ==
    > "undefined"?
    >
    > Any advice would be most appreciated!
    >
    > Rob
    > :)
    >
    >
     
    Robert Mark Bram, Aug 2, 2004
    #2
    1. Advertising

  3. ASP includes a type/bug where they misssssspell the server variable
    HTTP_REFERER as HTTP_REFERRER

    "Andrew Urquhart" <> wrote in
    message news:a9qPc.287$...
    > *Robert Mark Bram* wrote:
    > > *Robert Mark Bram* wrote:
    > >> I have the following in an ASP script:
    > >>
    > >> var bounceBackPage = Request.ServerVariables("HTTP_REFERER");
    > >> Response.Write("<p>bounceBackPage: " +
    > >> bounceBackPage + ". Undefined? " +
    > >> (bounceBackPage == "undefined") + " </p>");
    > >>
    > >> When I enter the page URL by itself, I expect HTTP_REFERER to be
    > >> undefined.. but this is the output I get:
    > >>
    > >> bounceBackPage: undefined. Undefined? false
    > >>
    > >> How can it print "undefined" and still return false for
    > >> bounceBackPage == "undefined"?

    > >
    > > Did this to solve my problem..
    > >
    > > bounceBackPage + "" == "undefined"
    > > which returns true.

    >
    > Do you understand why though?
    >
    > var objReferrer = Request.ServerVariables("HTTP_REFERER");
    > var strReferrer = objReferrer.Count() ? objReferrer.Item(1) : "";
    > --
    > Andrew Urquhart
    > - FAQ: www.jibbering.com/faq/
    > - Archive: www.google.com/groups?q=comp.lang.javascript
    > - Contact me: http://andrewu.co.uk/contact/
    > - Apologies for the wrong timestamp on my post - blame my ISP
    >
    >
     
    Marlo Brandon, Aug 2, 2004
    #3
  4. On Mon, 2 Aug 2004 06:12:12 -0600, "Marlo Brandon"
    <> wrote:
    in <>

    >ASP includes a type/bug where they misssssspell the server variable
    >HTTP_REFERER as HTTP_REFERRER


    I don't what dictionary you use but the Webster's Encyclopedic
    Unabridged Dictionary of the English Language shows ~referrer~ as
    the CORRECT spelling of the word.


    ---
    Stefan Berglund
     
    Stefan Berglund, Aug 2, 2004
    #4
  5. > I don't what dictionary you use but the Webster's Encyclopedic
    > Unabridged Dictionary of the English Language shows ~referrer~ as
    > the CORRECT spelling of the word.


    Why is this suddenly about English? Sheesh.

    Anyway, the correct spelling of the word is REFERRER. The serverVariable
    implemented by many web servers is HTTP_REFERER... *it* is what is
    misspelled.

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)
     
    Aaron [SQL Server MVP], Aug 2, 2004
    #5
  6. Robert Mark Bram wrote:
    > Hi All!
    >
    > I have the following in an ASP script:
    >
    > var bounceBackPage = Request.ServerVariables("HTTP_REFERER");
    > Response.Write("<p>bounceBackPage: " +
    > bounceBackPage + ". Undefined? " +
    > (bounceBackPage == "undefined") + " </p>");
    >
    > When I enter the page URL by itself, I expect HTTP_REFERER to be
    > undefined.. but this is the output I get:
    >
    > bounceBackPage: undefined. Undefined? false
    >
    > How can it print "undefined" and still return false for
    > bounceBackPage == "undefined"?
    >
    > Any advice would be most appreciated!


    You can certainly test this condition instead:
    (typeof Request.ServerVariables("HTTP_REFERER").Item == "undefined")

    If you prefer implicit boolean conversion, you can use this:
    (Request.ServerVariables("HTTP_REFERER").Item || "undefined")



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
     
    Dave Anderson, Aug 2, 2004
    #6
  7. Robert Mark Bram

    Mark Schupp Guest

    > I don't what dictionary you use but the Webster's Encyclopedic
    > Unabridged Dictionary of the English Language shows ~referrer~ as
    > the CORRECT spelling of the word.


    It's not a "word" it is an "identifier". Try this reference work (search the
    page for "referer")
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "Stefan Berglund" <> wrote in message
    news:...
    > On Mon, 2 Aug 2004 06:12:12 -0600, "Marlo Brandon"
    > <> wrote:
    > in <>
    >
    > >ASP includes a type/bug where they misssssspell the server variable
    > >HTTP_REFERER as HTTP_REFERRER

    >
    > I don't what dictionary you use but the Webster's Encyclopedic
    > Unabridged Dictionary of the English Language shows ~referrer~ as
    > the CORRECT spelling of the word.
    >
    >
    > ---
    > Stefan Berglund
     
    Mark Schupp, Aug 2, 2004
    #7
  8. On Mon, 2 Aug 2004 13:31:31 -0400, "Aaron [SQL Server MVP]"
    <> wrote:
    in <>

    >> I don't what dictionary you use but the Webster's Encyclopedic
    >> Unabridged Dictionary of the English Language shows ~referrer~ as
    >> the CORRECT spelling of the word.

    >
    >Why is this suddenly about English? Sheesh.
    >
    >Anyway, the correct spelling of the word is REFERRER. The serverVariable
    >implemented by many web servers is HTTP_REFERER... *it* is what is
    >misspelled.


    That is clearly obvious but that is not what was stated in the
    post I replied to.

    Thank you for reiterating exactly what I said. I am well aware
    of the distinction between the ~word~ and the ~identifier~ and
    had you quoted the additional two lines that I replied to, that
    would have been intuitively obvious to the most casual observer.

    Obviously, it's of little consequence either way, but in the
    future I'll refrain from reacting to blatantly incorrect
    statements especially when they're made by dead people.


    ---
    Stefan Berglund
     
    Stefan Berglund, Aug 3, 2004
    #8
    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. Drebin
    Replies:
    15
    Views:
    13,976
    slyi .
    Nov 23, 2004
  2. tshad

    HTTP_REFERER not always there

    tshad, Oct 14, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    3,257
    tshad
    Oct 18, 2005
  3. rambabuk1222

    HTTP_REFERER is not working

    rambabuk1222, Feb 26, 2010, in forum: .NET
    Replies:
    0
    Views:
    864
    rambabuk1222
    Feb 26, 2010
  4. HTTP_REFERER is not workign in web services

    , Mar 15, 2007, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    206
  5. Robert Mark Bram

    asp javascript HTTP_REFERER is or is not undefined?

    Robert Mark Bram, Aug 2, 2004, in forum: ASP General
    Replies:
    7
    Views:
    376
    Stefan Berglund
    Aug 3, 2004
Loading...

Share This Page