473,380 Members | 1,382 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,380 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 19 '05 #1
9 3894
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 19 '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 19 '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 19 '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 19 '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 19 '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 19 '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 19 '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 19 '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 19 '05 #10

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

Similar topics

3
by: Muffinman | last post by:
Hi, I have a script using the $_SERVER var. I now installed php 5 and this function does not work, 'undefined index' it says. Can anyone tell me what could be wrong? Thanks in advance,...
2
by: Brian | last post by:
Hi All, Can someone please point me in the right direction I am having problems combining JS and ASP. What I am trying to do is store in a database using ASP the referring page of my visitors. ...
0
by: Daniel | last post by:
how to change the value of Request.ServerVariables on the ser ver? if not possible is there some way to change it by sending back javascript to the client and having the client automaticaly do...
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? " +...
9
by: David D. | last post by:
Does the file extension matter when including a JavaScript file in an HTML page? Normally, one would include a JavaScript file in an HTML page using <script src="foo.JS" type="text/javascript">...
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. ...
8
by: mrsmithq | last post by:
I have a page that has this logic in it: //We can call it access.php if (!isset($_SESSION)){ header("Location:index.php"); exit(); } //Here is the index.php echo "<br>" . $_SERVER;
1
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.