asp javascript HTTP_REFERER is or is not undefined?

  • Thread starter Robert Mark Bram
  • Start date
R

Robert Mark Bram

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
:)
 
R

Robert Mark Bram

Did this to solve my problem..

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

Rob
:)
 
M

Marlo Brandon

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

Stefan Berglund

On Mon, 2 Aug 2004 06:12:12 -0600, "Marlo Brandon"
in said:
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.
 
A

Aaron [SQL Server MVP]

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.
 
D

Dave Anderson

Robert said:
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.
 
S

Stefan Berglund

On Mon, 2 Aug 2004 13:31:31 -0400, "Aaron [SQL Server MVP]"
in said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top