asp javascript HTTP_REFERER is or is not undefined?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Mark Bram

    asp javascript HTTP_REFERER is or is not undefined?

    Hi All!

    I have the following in an ASP script:

    var bounceBackPage = Request.ServerV ariables("HTTP_ REFERER");
    Response.Write( "<p>bounceBackP age: " +
    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

    #2
    Re: asp javascript HTTP_REFERER is or is not undefined?

    Did this to solve my problem..

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

    Rob
    :)


    "Robert Mark Bram" <none> wrote in message
    news:410e14b0$0 $29782$afc38c87 @news.optusnet. com.au...[color=blue]
    > Hi All!
    >
    > I have the following in an ASP script:
    >
    > var bounceBackPage = Request.ServerV ariables("HTTP_ REFERER");
    > Response.Write( "<p>bounceBackP age: " +
    > bounceBackPage + ". Undefined? " +
    > (bounceBackPage == "undefined" ) + " </p>");
    >
    > When I enter the page URL by itself, I expect HTTP_REFERER to be[/color]
    undefined..[color=blue]
    > 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
    > :)
    >
    >[/color]


    Comment

    • Andrew Urquhart

      #3
      Re: asp javascript HTTP_REFERER is or is not undefined?

      *Robert Mark Bram* wrote:[color=blue]
      > *Robert Mark Bram* wrote:[color=green]
      >> I have the following in an ASP script:
      >>
      >> var bounceBackPage = Request.ServerV ariables("HTTP_ REFERER");
      >> Response.Write( "<p>bounceBackP age: " +
      >> 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" ?[/color]
      >
      > Did this to solve my problem..
      >
      > bounceBackPage + "" == "undefined"
      > which returns true.[/color]

      Do you understand why though?

      var objReferrer = Request.ServerV ariables("HTTP_ REFERER");
      var strReferrer = objReferrer.Cou nt() ? objReferrer.Ite m(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


      Comment

      • Marlo Brandon

        #4
        Re: asp javascript HTTP_REFERER is or is not undefined?

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

        "Andrew Urquhart" <useWebsiteInSi gnatureToReply@ spam.invalid> wrote in
        message news:a9qPc.287$ kK3.115@newsfe5-gui.ntli.net...[color=blue]
        > *Robert Mark Bram* wrote:[color=green]
        > > *Robert Mark Bram* wrote:[color=darkred]
        > >> I have the following in an ASP script:
        > >>
        > >> var bounceBackPage = Request.ServerV ariables("HTTP_ REFERER");
        > >> Response.Write( "<p>bounceBackP age: " +
        > >> 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" ?[/color]
        > >
        > > Did this to solve my problem..
        > >
        > > bounceBackPage + "" == "undefined"
        > > which returns true.[/color]
        >
        > Do you understand why though?
        >
        > var objReferrer = Request.ServerV ariables("HTTP_ REFERER");
        > var strReferrer = objReferrer.Cou nt() ? objReferrer.Ite m(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
        >
        >[/color]


        Comment

        • Andrew Urquhart

          #5
          Re: asp javascript HTTP_REFERER is or is not undefined?

          *Marlo Brandon* wrote:[color=blue]
          > "Andrew Urquhart" wrote:[/color]
          [ Work around for Request.ServerV ariables("HTTP_ REFERER") not being a
          string ][color=blue][color=green]
          >> Do you understand why though?
          >>
          >> var objReferrer = Request.ServerV ariables("HTTP_ REFERER");
          >> var strReferrer = objReferrer.Cou nt() ? objReferrer.Ite m(1) : "";[/color]
          >
          > ASP includes a type/bug where they misssssspell the server variable
          > HTTP_REFERER as HTTP_REFERRER[/color]

          The HTTP spec has the misspelling, it's carried over into ASP and a
          dozen other languages/frameworks. In what way does this assist the OP
          though?
          --
          Andrew Urquhart
          - Contact me: http://andrewu.co.uk/contact/
          - Apologies for the wrong timestamp on my post - blame my ISP


          Comment

          • Stefan Berglund

            #6
            Re: asp javascript HTTP_REFERER is or is not undefined?

            On Mon, 2 Aug 2004 06:12:12 -0600, "Marlo Brandon"
            <MarloBrandon@M arloBrandon.com > wrote:
            in <NYydndwGi98Asp PcRVn-rw@comcast.com>
            [color=blue]
            >ASP includes a type/bug where they misssssspell the server variable
            >HTTP_REFERER as HTTP_REFERRER[/color]

            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

            Comment

            • Aaron [SQL Server MVP]

              #7
              Re: asp javascript HTTP_REFERER is or is not undefined?

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

              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.

              --

              (Reverse address to reply.)


              Comment

              • Dave Anderson

                #8
                Re: asp javascript HTTP_REFERER is or is not undefined?

                Robert Mark Bram wrote:[color=blue]
                > Hi All!
                >
                > I have the following in an ASP script:
                >
                > var bounceBackPage = Request.ServerV ariables("HTTP_ REFERER");
                > Response.Write( "<p>bounceBackP age: " +
                > 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![/color]

                You can certainly test this condition instead:
                (typeof Request.ServerV ariables("HTTP_ REFERER").Item == "undefined" )

                If you prefer implicit boolean conversion, you can use this:
                (Request.Server Variables("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.


                Comment

                • Mark Schupp

                  #9
                  Re: asp javascript HTTP_REFERER is or is not undefined?

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

                  It's not a "word" it is an "identifier ". Try this reference work (search the
                  page for "referer")


                  --
                  Mark Schupp
                  Head of Development
                  Integrity eLearning
                  Advancing limitless knowledge and continual growth to create confident problem solvers, one course at a time.



                  "Stefan Berglund" <keepit@in.theg roups> wrote in message
                  news:rdtsg09v4g pub4pi8h8u9k8hi ttcb75uc4@4ax.c om...[color=blue]
                  > On Mon, 2 Aug 2004 06:12:12 -0600, "Marlo Brandon"
                  > <MarloBrandon@M arloBrandon.com > wrote:
                  > in <NYydndwGi98Asp PcRVn-rw@comcast.com>
                  >[color=green]
                  > >ASP includes a type/bug where they misssssspell the server variable
                  > >HTTP_REFERER as HTTP_REFERRER[/color]
                  >
                  > 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[/color]


                  Comment

                  • Stefan Berglund

                    #10
                    Re: asp javascript HTTP_REFERER is or is not undefined?

                    On Mon, 2 Aug 2004 13:31:31 -0400, "Aaron [SQL Server MVP]"
                    <ten.xoc@dnartr eb.noraa> wrote:
                    in <eaujgaLeEHA.55 6@tk2msftngp13. phx.gbl>
                    [color=blue][color=green]
                    >> 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.[/color]
                    >
                    >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.[/color]

                    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

                    Comment

                    Working...