473,320 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

asp javascript HTTP_REFERER is or is not undefined?

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
:)
Jul 23 '05 #1
9 1903
Did this to solve my problem..

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

Rob
:)
"Robert Mark Bram" <none> wrote in message
news:41***********************@news.optusnet.com.a u...
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
:)

Jul 23 '05 #2
*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
Jul 23 '05 #3
ASP includes a type/bug where they misssssspell the server variable
HTTP_REFERER as HTTP_REFERRER

"Andrew Urquhart" <us**************************@spam.invalid> wrote in
message news:a9***************@newsfe5-gui.ntli.net...
*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

Jul 23 '05 #4
*Marlo Brandon* wrote:
"Andrew Urquhart" wrote:

[ Work around for Request.ServerVariables("HTTP_REFERER") not being a
string ]
Do you understand why though?

var objReferrer = Request.ServerVariables("HTTP_REFERER");
var strReferrer = objReferrer.Count() ? objReferrer.Item(1) : "";


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


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
Jul 23 '05 #5
On Mon, 2 Aug 2004 06:12:12 -0600, "Marlo Brandon"
<Ma**********@MarloBrandon.com> wrote:
in <NY********************@comcast.com>
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
Jul 23 '05 #6
> 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.)
Jul 23 '05 #7
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.
Jul 23 '05 #8
> 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" <ke****@in.thegroups> wrote in message
news:rd********************************@4ax.com... On Mon, 2 Aug 2004 06:12:12 -0600, "Marlo Brandon"
<Ma**********@MarloBrandon.com> wrote:
in <NY********************@comcast.com>
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

Jul 23 '05 #9
On Mon, 2 Aug 2004 13:31:31 -0400, "Aaron [SQL Server MVP]"
<te*****@dnartreb.noraa> wrote:
in <ea*************@tk2msftngp13.phx.gbl>
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
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Robert Mark Bram | last post by:
Hi All! I have the following in an ASP script: var bounceBackPage = Request.ServerVariables("HTTP_REFERER"); Response.Write("<p>bounceBackPage: " + bounceBackPage + ". Undefined? " +...
2
by: | last post by:
1. If this is OT please point me to the correct ng. 2. I don't know what javascript is, what it does, how to read it, where to find it or what to do with it. 3. Metacrawler was no help. 4. I'm...
4
by: Ringo Langly | last post by:
Hi everyone, We're using an outside vendor to provide some content for our website, and they use the http_referer variable to verify their content is only viewed from subscribing customers. ...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
4
by: Gary Varga | last post by:
Are you getting confused between client and server? Should it be: > >Source Error: > >Line 39: >Line 40: <DIV ID=divOverview >Line 41: STYLE=CustomHeightedStyle()
3
by: jimmygoogle | last post by:
I posted earlier with a scope problem. I think I resolved it in IE but in Firefox it still exists. Anyone have any ideas/experience with this? I attached my code sorry it is so long. You can...
11
by: redog6 | last post by:
Hello I have the above javascript error on filling in mandatory fields and submitting the form below: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.