By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Script Error

P: n/a
JA
Hi,

I have this JavaScript that is supposed to show random products from my
database, and show something different every time you refresh or revisit.
But I keep getting an error - on my computer - that says Syntax Error in
Line 2.

There is no error on most other computers, and the products show, but
another script on the page, an article title scroller, stops - on most
computers, but not all. It says "no articles available".

I've tried the script on an asp page and a htm page, all by itself, but it
still doesn't work. I tried changing all kinds of settings in my browsers,
but nothing helps. I'm on XP, SP2, which I've heard has some problems
handling javascripts. I don't know if that's true, but if it is, I know that
lots of other people will have the same problem as me when they view the
page. Actually, I think it is a good thing, that my computer is pointing out
this error. I get the error message in IE6, but in NS8 and FF, I just don't
see the products. No error message.

Anyway, here are the first three lines of the script:

<%
if TRIM(request.servervariables("http_referer")) = "" then
%>

Using spellcheck, I found that referer is spelled wrong, it should be
referrer. I don't know if that is right for javascript (or asp?), but
correcting it didn't make a difference.

The script is JavaScript on an asp page, and it is called in an htm page.

Is the error obvious from the 3 lines?

Thanks for any help,

JA

Aug 12 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
"JA" <ja*****@kc.rr.com> wrote in message
news:zc****************@tornado.rdc-kc.rr.com...
Hi,

I have this JavaScript that is supposed to show random products from my
database, and show something different every time you refresh or revisit.
But I keep getting an error - on my computer - that says Syntax Error in
Line 2.

There is no error on most other computers, and the products show, but
another script on the page, an article title scroller, stops - on most
computers, but not all. It says "no articles available".

I've tried the script on an asp page and a htm page, all by itself, but it
still doesn't work. I tried changing all kinds of settings in my browsers,
but nothing helps. I'm on XP, SP2, which I've heard has some problems
handling javascripts. I don't know if that's true, but if it is, I know that lots of other people will have the same problem as me when they view the
page. Actually, I think it is a good thing, that my computer is pointing out this error. I get the error message in IE6, but in NS8 and FF, I just don't see the products. No error message.

Anyway, here are the first three lines of the script:

<%
if TRIM(request.servervariables("http_referer")) = "" then
%>

Using spellcheck, I found that referer is spelled wrong, it should be
referrer. I don't know if that is right for javascript (or asp?), but
correcting it didn't make a difference.

The script is JavaScript on an asp page, and it is called in an htm page.

Is the error obvious from the 3 lines?

Thanks for any help,

JA


"http_referer" is blocked by many firewalls; (e.g. Norton).
Aug 12 '05 #2

P: n/a
JA

I have Zone Alarm, would that do it? Also Norton Anti-Virus.

What can be done about it? What can it be changed to that wouldn't get
blocked?

Thanks, JA
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:Ve*****************************************@c omcast.com...
"JA" <ja*****@kc.rr.com> wrote in message
news:zc****************@tornado.rdc-kc.rr.com...
Hi,

I have this JavaScript that is supposed to show random products from my
database, and show something different every time you refresh or revisit.
But I keep getting an error - on my computer - that says Syntax Error in
Line 2.

There is no error on most other computers, and the products show, but
another script on the page, an article title scroller, stops - on most
computers, but not all. It says "no articles available".

I've tried the script on an asp page and a htm page, all by itself, but
it
still doesn't work. I tried changing all kinds of settings in my
browsers,
but nothing helps. I'm on XP, SP2, which I've heard has some problems
handling javascripts. I don't know if that's true, but if it is, I know

that
lots of other people will have the same problem as me when they view the
page. Actually, I think it is a good thing, that my computer is pointing

out
this error. I get the error message in IE6, but in NS8 and FF, I just

don't
see the products. No error message.

Anyway, here are the first three lines of the script:

<%
if TRIM(request.servervariables("http_referer")) = "" then
%>

Using spellcheck, I found that referer is spelled wrong, it should be
referrer. I don't know if that is right for javascript (or asp?), but
correcting it didn't make a difference.

The script is JavaScript on an asp page, and it is called in an htm page.

Is the error obvious from the 3 lines?

Thanks for any help,

JA


"http_referer" is blocked by many firewalls; (e.g. Norton).

Aug 12 '05 #3

P: n/a
JA wrote:
I have this JavaScript that is supposed to show random products from my
database, and show something different every time you refresh or revisit.
But I keep getting an error - on my computer - that says Syntax Error in
Line 2. Anyway, here are the first three lines of the script: <%
if TRIM(request.servervariables("http_referer")) = "" then
%>
This looks like ASP/VBScript, not JavaScript. If your browser is reporting
an error on line 2, then its line 2 of the output that the browser
receives, not line 2 of the program that generates the output.
Using spellcheck, I found that referer is spelled wrong, it should be
referrer.


http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

The Referer[sic] request-header field allows the client to specify, for
the server's benefit, the address (URI) of the resource from which the
Request-URI was obtained (the "referrer", although the header field is
misspelled.)

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Aug 12 '05 #4

P: n/a
"JA" <ja*****@kc.rr.com> wrote in message
news:6K****************@tornado.rdc-kc.rr.com...

I have Zone Alarm, would that do it? Also Norton Anti-Virus.

What can be done about it? What can it be changed to that wouldn't get
blocked?

Thanks, JA


[snip]

http://www.hotdogblog.com/modules/smartfaq/index.php

For security reasons, when you post a reply etc, the site checks that you
have actually come from a page on the forum using what is called a
HTTP_REFERER. This ensures that database entries can only come from the
right page, and stops any external scripts (and would-be-if-they-could-be
hackers)from entering info from souces OTHER than the forum reply page
itself.

Unfortunately, some firewall and web filtering software, such as some
versions of Zone Alarm, block HTTP_REFERER's by default.

# Disable WebWasher Standard Filter/URL Filter
# Disable any "ad blocking" software
# Disable any Pop-up blockers

----------------------------------------------------------
Zone Alarm Pro:

1. Click Privacy
2. Click Cookie Control
3. Click Custom
4. Uncheck "remove private header information"

Aug 12 '05 #5

P: n/a
McA
> Anyway, here are the first three lines of the script:
<%
if TRIM(request.servervariables("http_referer")) = "" then
%>


Use request.servervariables("HTTP_REFERRER")

BTW this is VBS
Aug 12 '05 #6

P: n/a
"JA" <ja*****@kc.rr.com> wrote in message
news:zc****************@tornado.rdc-kc.rr.com...
Hi,

I have this JavaScript that is supposed to show random products from my
database, and show something different every time you refresh or revisit.
But I keep getting an error - on my computer - that says Syntax Error in
Line 2. <%
if TRIM(request.servervariables("http_referer")) = "" then
%> The script is JavaScript on an asp page, and it is called in an htm page.


That looks more like vbscript which only works on Internet Explorer and
servers which allow it.
Also, don't forget the "end if". You can only omit it when the if/then
statement is all on one line.

eg:
if {condition} then {do something}
if {condition} then
{do something else}
end if

As for the spelling of "referer", try this link
http://en.wikipedia.org/wiki/Referer
Aug 12 '05 #7

P: n/a
[snip]
That looks more like vbscript which only works on Internet Explorer and
servers which allow it.


[snip]

"vbscript which only works on Internet Explorer"
This would be true if it were client-side script.

ASP runs server-side.
Aug 12 '05 #8

P: n/a
On Friday 12 August 2005 19:05, McKirahan(Ne**@McKirahan.com) wrote in
message <jK********************@comcast.com>
[snip]
That looks more like vbscript which only works on Internet Explorer and
servers which allow it.


[snip]

"vbscript which only works on Internet Explorer"
This would be true if it were client-side script.

ASP runs server-side.


[Danny@Kendal, posting from home]

Next you'll be telling me that PHP and MySql are server-side as well. ;-)
Aug 12 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.