Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > asp page with browser sniffer doesn't work in Netscape

Reply
Thread Tools

asp page with browser sniffer doesn't work in Netscape

 
 
AMC
Guest
Posts: n/a
 
      01-14-2005
Hi,

I have the below code in an asp page. When I run this page in IE or Opera it
correctly displays the header info and does not redirect me to 'test.html'.
However, when I run this in Netscape it goes straight to the redirect page
'test.html' which indicates that javascript is not enabled and it also does
not display the header info. Can someone tell me why this is happening?

<%@ Language=VBScript%>
<%'get header info
Response.Write Request.ServerVariables("HTTP_USER_AGENT")

'detect javascript
Set bc = Server.CreateObject("MSWC.BrowserType") %>
Browser Name: <%=bc.browser %>
Browser Version: <%=bc.version%>

<%
if (bc.javascript = FALSE) then
response.write("no javascript")
response.Redirect("Test.html")
else
response.write("has javascript")

end if
set bc=nothing
%>





 
Reply With Quote
 
 
 
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      01-14-2005
Not that anyone uses Netscape anymore, but this is a pretty silly way to
test whether a user has JavaScript enabled, anyway. All you are testing is
that they are using a browser that *supports* JavaScript. They can easily
turn it off, and the test you are doing will still pass.

http://www.aspfaq.com/2058

--
http://www.aspfaq.com/
(Reverse address to reply.)




"AMC" <(E-Mail Removed)> wrote in message
news:uFzgAMk#(E-Mail Removed)...
> Hi,
>
> I have the below code in an asp page. When I run this page in IE or Opera

it
> correctly displays the header info and does not redirect me to

'test.html'.
> However, when I run this in Netscape it goes straight to the redirect page
> 'test.html' which indicates that javascript is not enabled and it also

does
> not display the header info. Can someone tell me why this is happening?
>
> <%@ Language=VBScript%>
> <%'get header info
> Response.Write Request.ServerVariables("HTTP_USER_AGENT")
>
> 'detect javascript
> Set bc = Server.CreateObject("MSWC.BrowserType") %>
> Browser Name: <%=bc.browser %>
> Browser Version: <%=bc.version%>
>
> <%
> if (bc.javascript = FALSE) then
> response.write("no javascript")
> response.Redirect("Test.html")
> else
> response.write("has javascript")
>
> end if
> set bc=nothing
> %>
>
>
>
>
>



 
Reply With Quote
 
 
 
 
AMC
Guest
Posts: n/a
 
      01-14-2005
Well,

Plenty of my users still have Netscape so this needs to work. I have
JavaScript enabled in Netscape but the asp page is redirecting to
the test page which indicates that it is not enabled or *supported*. Do you
have any valid information relating to this problem?


"Aaron [SQL Server MVP]" <(E-Mail Removed)> wrote in message
news:eg6GHAl%(E-Mail Removed)...
> Not that anyone uses Netscape anymore, but this is a pretty silly way to
> test whether a user has JavaScript enabled, anyway. All you are testing

is
> that they are using a browser that *supports* JavaScript. They can easily
> turn it off, and the test you are doing will still pass.
>
> http://www.aspfaq.com/2058
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
>
>
> "AMC" <(E-Mail Removed)> wrote in message
> news:uFzgAMk#(E-Mail Removed)...
> > Hi,
> >
> > I have the below code in an asp page. When I run this page in IE or

Opera
> it
> > correctly displays the header info and does not redirect me to

> 'test.html'.
> > However, when I run this in Netscape it goes straight to the redirect

page
> > 'test.html' which indicates that javascript is not enabled and it also

> does
> > not display the header info. Can someone tell me why this is happening?
> >
> > <%@ Language=VBScript%>
> > <%'get header info
> > Response.Write Request.ServerVariables("HTTP_USER_AGENT")
> >
> > 'detect javascript
> > Set bc = Server.CreateObject("MSWC.BrowserType") %>
> > Browser Name: <%=bc.browser %>
> > Browser Version: <%=bc.version%>
> >
> > <%
> > if (bc.javascript = FALSE) then
> > response.write("no javascript")
> > response.Redirect("Test.html")
> > else
> > response.write("has javascript")
> >
> > end if
> > set bc=nothing
> > %>
> >
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      01-14-2005
Did you see the link I posted? Use JAVASCRIPT to determine if JavaScript is
enabled, not some stupid browser capabilities object that merely tells you
that JavaScript is SUPPORTED. Do you hire people based solely on what they
say on their resume, or only after they've actually demonstrated that they
can do what they say they can?

--
http://www.aspfaq.com/
(Reverse address to reply.)




"AMC" <(E-Mail Removed)> wrote in message
news:#RzvaIl#(E-Mail Removed)...
> Well,
>
> Plenty of my users still have Netscape so this needs to work. I have
> JavaScript enabled in Netscape but the asp page is redirecting to
> the test page which indicates that it is not enabled or *supported*. Do

you
> have any valid information relating to this problem?
>
>
> "Aaron [SQL Server MVP]" <(E-Mail Removed)> wrote in message
> news:eg6GHAl%(E-Mail Removed)...
> > Not that anyone uses Netscape anymore, but this is a pretty silly way to
> > test whether a user has JavaScript enabled, anyway. All you are testing

> is
> > that they are using a browser that *supports* JavaScript. They can

easily
> > turn it off, and the test you are doing will still pass.
> >
> > http://www.aspfaq.com/2058
> >
> > --
> > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
> >
> >
> > "AMC" <(E-Mail Removed)> wrote in message
> > news:uFzgAMk#(E-Mail Removed)...
> > > Hi,
> > >
> > > I have the below code in an asp page. When I run this page in IE or

> Opera
> > it
> > > correctly displays the header info and does not redirect me to

> > 'test.html'.
> > > However, when I run this in Netscape it goes straight to the redirect

> page
> > > 'test.html' which indicates that javascript is not enabled and it also

> > does
> > > not display the header info. Can someone tell me why this is

happening?
> > >
> > > <%@ Language=VBScript%>
> > > <%'get header info
> > > Response.Write Request.ServerVariables("HTTP_USER_AGENT")
> > >
> > > 'detect javascript
> > > Set bc = Server.CreateObject("MSWC.BrowserType") %>
> > > Browser Name: <%=bc.browser %>
> > > Browser Version: <%=bc.version%>
> > >
> > > <%
> > > if (bc.javascript = FALSE) then
> > > response.write("no javascript")
> > > response.Redirect("Test.html")
> > > else
> > > response.write("has javascript")
> > >
> > > end if
> > > set bc=nothing
> > > %>
> > >
> > >
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
AMC
Guest
Posts: n/a
 
      01-14-2005
Duh,

Yes I saw the link you posted, and I am well aware of Browserhawk etc. For
reasons that I won't waste my time explaining again JAVASCRIPT is not an
option.

For your info, the only 'stupidity' is in your inane replies to my post. Who
I hire has no relevance to this thread, but since your asked
I wouldn't hire you because you have clearly demonstrated that you don't
know squat!

Keep posting, and I'll keep laughing!!!

"Aaron [SQL Server MVP]" <(E-Mail Removed)> wrote in message
news:%23tQqCLl%(E-Mail Removed)...
> Did you see the link I posted? Use JAVASCRIPT to determine if JavaScript

is
> enabled, not some stupid browser capabilities object that merely tells you
> that JavaScript is SUPPORTED. Do you hire people based solely on what

they
> say on their resume, or only after they've actually demonstrated that they
> can do what they say they can?
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
>
>
> "AMC" <(E-Mail Removed)> wrote in message
> news:#RzvaIl#(E-Mail Removed)...
> > Well,
> >
> > Plenty of my users still have Netscape so this needs to work. I have
> > JavaScript enabled in Netscape but the asp page is redirecting to
> > the test page which indicates that it is not enabled or *supported*. Do

> you
> > have any valid information relating to this problem?
> >
> >
> > "Aaron [SQL Server MVP]" <(E-Mail Removed)> wrote in message
> > news:eg6GHAl%(E-Mail Removed)...
> > > Not that anyone uses Netscape anymore, but this is a pretty silly way

to
> > > test whether a user has JavaScript enabled, anyway. All you are

testing
> > is
> > > that they are using a browser that *supports* JavaScript. They can

> easily
> > > turn it off, and the test you are doing will still pass.
> > >
> > > http://www.aspfaq.com/2058
> > >
> > > --
> > > http://www.aspfaq.com/
> > > (Reverse address to reply.)
> > >
> > >
> > >
> > >
> > > "AMC" <(E-Mail Removed)> wrote in message
> > > news:uFzgAMk#(E-Mail Removed)...
> > > > Hi,
> > > >
> > > > I have the below code in an asp page. When I run this page in IE or

> > Opera
> > > it
> > > > correctly displays the header info and does not redirect me to
> > > 'test.html'.
> > > > However, when I run this in Netscape it goes straight to the

redirect
> > page
> > > > 'test.html' which indicates that javascript is not enabled and it

also
> > > does
> > > > not display the header info. Can someone tell me why this is

> happening?
> > > >
> > > > <%@ Language=VBScript%>
> > > > <%'get header info
> > > > Response.Write Request.ServerVariables("HTTP_USER_AGENT")
> > > >
> > > > 'detect javascript
> > > > Set bc = Server.CreateObject("MSWC.BrowserType") %>
> > > > Browser Name: <%=bc.browser %>
> > > > Browser Version: <%=bc.version%>
> > > >
> > > > <%
> > > > if (bc.javascript = FALSE) then
> > > > response.write("no javascript")
> > > > response.Redirect("Test.html")
> > > > else
> > > > response.write("has javascript")
> > > >
> > > > end if
> > > > set bc=nothing
> > > > %>
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      01-14-2005
Wow, you're a bad programmer AND an a**hole. Good job.

*PLONK*




"AMC" <(E-Mail Removed)> wrote in message
news:#z0ctXl#(E-Mail Removed)...
> Duh,
>
> Yes I saw the link you posted, and I am well aware of Browserhawk etc. For
> reasons that I won't waste my time explaining again JAVASCRIPT is not an
> option.
>
> For your info, the only 'stupidity' is in your inane replies to my post.

Who
> I hire has no relevance to this thread, but since your asked
> I wouldn't hire you because you have clearly demonstrated that you don't
> know squat!
>
> Keep posting, and I'll keep laughing!!!
>



 
Reply With Quote
 
Bob Lehmann
Guest
Posts: n/a
 
      01-14-2005
>>For reasons that I won't waste my time explaining again JAVASCRIPT is not
an option.
Again? I can't find where you explained it once.

Bob Lehmann

"AMC" <(E-Mail Removed)> wrote in message
news:#z0ctXl#(E-Mail Removed)...
> Duh,
>
> Yes I saw the link you posted, and I am well aware of Browserhawk etc. For
> reasons that I won't waste my time explaining again JAVASCRIPT is not an
> option.
>
> For your info, the only 'stupidity' is in your inane replies to my post.

Who
> I hire has no relevance to this thread, but since your asked
> I wouldn't hire you because you have clearly demonstrated that you don't
> know squat!
>
> Keep posting, and I'll keep laughing!!!
>
> "Aaron [SQL Server MVP]" <(E-Mail Removed)> wrote in message
> news:%23tQqCLl%(E-Mail Removed)...
> > Did you see the link I posted? Use JAVASCRIPT to determine if

JavaScript
> is
> > enabled, not some stupid browser capabilities object that merely tells

you
> > that JavaScript is SUPPORTED. Do you hire people based solely on what

> they
> > say on their resume, or only after they've actually demonstrated that

they
> > can do what they say they can?
> >
> > --
> > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
> >
> >
> > "AMC" <(E-Mail Removed)> wrote in message
> > news:#RzvaIl#(E-Mail Removed)...
> > > Well,
> > >
> > > Plenty of my users still have Netscape so this needs to work. I have
> > > JavaScript enabled in Netscape but the asp page is redirecting to
> > > the test page which indicates that it is not enabled or *supported*.

Do
> > you
> > > have any valid information relating to this problem?
> > >
> > >
> > > "Aaron [SQL Server MVP]" <(E-Mail Removed)> wrote in message
> > > news:eg6GHAl%(E-Mail Removed)...
> > > > Not that anyone uses Netscape anymore, but this is a pretty silly

way
> to
> > > > test whether a user has JavaScript enabled, anyway. All you are

> testing
> > > is
> > > > that they are using a browser that *supports* JavaScript. They can

> > easily
> > > > turn it off, and the test you are doing will still pass.
> > > >
> > > > http://www.aspfaq.com/2058
> > > >
> > > > --
> > > > http://www.aspfaq.com/
> > > > (Reverse address to reply.)
> > > >
> > > >
> > > >
> > > >
> > > > "AMC" <(E-Mail Removed)> wrote in message
> > > > news:uFzgAMk#(E-Mail Removed)...
> > > > > Hi,
> > > > >
> > > > > I have the below code in an asp page. When I run this page in IE

or
> > > Opera
> > > > it
> > > > > correctly displays the header info and does not redirect me to
> > > > 'test.html'.
> > > > > However, when I run this in Netscape it goes straight to the

> redirect
> > > page
> > > > > 'test.html' which indicates that javascript is not enabled and it

> also
> > > > does
> > > > > not display the header info. Can someone tell me why this is

> > happening?
> > > > >
> > > > > <%@ Language=VBScript%>
> > > > > <%'get header info
> > > > > Response.Write Request.ServerVariables("HTTP_USER_AGENT")
> > > > >
> > > > > 'detect javascript
> > > > > Set bc = Server.CreateObject("MSWC.BrowserType") %>
> > > > > Browser Name: <%=bc.browser %>
> > > > > Browser Version: <%=bc.version%>
> > > > >
> > > > > <%
> > > > > if (bc.javascript = FALSE) then
> > > > > response.write("no javascript")
> > > > > response.Redirect("Test.html")
> > > > > else
> > > > > response.write("has javascript")
> > > > >
> > > > > end if
> > > > > set bc=nothing
> > > > > %>
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Rasta
Guest
Posts: n/a
 
      01-14-2005
The only question I need answered is why doesn't this script work in
Netscape:

<%@ Language=VBScript%>
> > > > > > <%'get header info
> > > > > > Response.Write Request.ServerVariables("HTTP_USER_AGENT")
> > > > > >
> > > > > > 'detect javascript
> > > > > > Set bc = Server.CreateObject("MSWC.BrowserType") %>
> > > > > > Browser Name: <%=bc.browser %>
> > > > > > Browser Version: <%=bc.version%>
> > > > > >
> > > > > > <%
> > > > > > if (bc.javascript = FALSE) then
> > > > > > response.write("no javascript")
> > > > > > response.Redirect("Test.html")
> > > > > > else
> > > > > > response.write("has javascript")
> > > > > >
> > > > > > end if
> > > > > > set bc=nothing
> > > > > > %>




"Bob Lehmann" <none> wrote in message
news:ObYZEYm%(E-Mail Removed)...
> >>For reasons that I won't waste my time explaining again JAVASCRIPT is

not
> an option.
> Again? I can't find where you explained it once.
>
> Bob Lehmann
>
> "AMC" <(E-Mail Removed)> wrote in message
> news:#z0ctXl#(E-Mail Removed)...
> > Duh,
> >
> > Yes I saw the link you posted, and I am well aware of Browserhawk etc.

For
> > reasons that I won't waste my time explaining again JAVASCRIPT is not an
> > option.
> >
> > For your info, the only 'stupidity' is in your inane replies to my post.

> Who
> > I hire has no relevance to this thread, but since your asked
> > I wouldn't hire you because you have clearly demonstrated that you don't
> > know squat!
> >
> > Keep posting, and I'll keep laughing!!!
> >
> > "Aaron [SQL Server MVP]" <(E-Mail Removed)> wrote in message
> > news:%23tQqCLl%(E-Mail Removed)...
> > > Did you see the link I posted? Use JAVASCRIPT to determine if

> JavaScript
> > is
> > > enabled, not some stupid browser capabilities object that merely tells

> you
> > > that JavaScript is SUPPORTED. Do you hire people based solely on what

> > they
> > > say on their resume, or only after they've actually demonstrated that

> they
> > > can do what they say they can?
> > >
> > > --
> > > http://www.aspfaq.com/
> > > (Reverse address to reply.)
> > >
> > >
> > >
> > >
> > > "AMC" <(E-Mail Removed)> wrote in message
> > > news:#RzvaIl#(E-Mail Removed)...
> > > > Well,
> > > >
> > > > Plenty of my users still have Netscape so this needs to work. I have
> > > > JavaScript enabled in Netscape but the asp page is redirecting to
> > > > the test page which indicates that it is not enabled or *supported*.

> Do
> > > you
> > > > have any valid information relating to this problem?
> > > >
> > > >
> > > > "Aaron [SQL Server MVP]" <(E-Mail Removed)> wrote in message
> > > > news:eg6GHAl%(E-Mail Removed)...
> > > > > Not that anyone uses Netscape anymore, but this is a pretty silly

> way
> > to
> > > > > test whether a user has JavaScript enabled, anyway. All you are

> > testing
> > > > is
> > > > > that they are using a browser that *supports* JavaScript. They

can
> > > easily
> > > > > turn it off, and the test you are doing will still pass.
> > > > >
> > > > > http://www.aspfaq.com/2058
> > > > >
> > > > > --
> > > > > http://www.aspfaq.com/
> > > > > (Reverse address to reply.)
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "AMC" <(E-Mail Removed)> wrote in message
> > > > > news:uFzgAMk#(E-Mail Removed)...
> > > > > > Hi,
> > > > > >
> > > > > > I have the below code in an asp page. When I run this page in IE

> or
> > > > Opera
> > > > > it
> > > > > > correctly displays the header info and does not redirect me to
> > > > > 'test.html'.
> > > > > > However, when I run this in Netscape it goes straight to the

> > redirect
> > > > page
> > > > > > 'test.html' which indicates that javascript is not enabled and

it
> > also
> > > > > does
> > > > > > not display the header info. Can someone tell me why this is
> > > happening?
> > > > > >
> > > > > > <%@ Language=VBScript%>
> > > > > > <%'get header info
> > > > > > Response.Write Request.ServerVariables("HTTP_USER_AGENT")
> > > > > >
> > > > > > 'detect javascript
> > > > > > Set bc = Server.CreateObject("MSWC.BrowserType") %>
> > > > > > Browser Name: <%=bc.browser %>
> > > > > > Browser Version: <%=bc.version%>
> > > > > >
> > > > > > <%
> > > > > > if (bc.javascript = FALSE) then
> > > > > > response.write("no javascript")
> > > > > > response.Redirect("Test.html")
> > > > > > else
> > > > > > response.write("has javascript")
> > > > > >
> > > > > > end if
> > > > > > set bc=nothing
> > > > > > %>
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Dave Anderson
Guest
Posts: n/a
 
      01-14-2005
AMC wrote:
> if (bc.javascript = FALSE) then
> response.write("no javascript")
> response.Redirect("Test.html")


Response.Write and Response.Redirect are incompatible:

"Any response body content such as displayed HTML text or
Response.Write text in the page indicated by the original
URL is ignored."

http://msdn.microsoft.com/library/en...om_resomre.asp



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


 
Reply With Quote
 
Dave Anderson
Guest
Posts: n/a
 
      01-14-2005
Rasta wrote:
> The only question I need answered is why doesn't this script
> work in Netscape:


Among other things, because it is being interpreted by IIS (on the server
side), not by Netscape. But let's break it down:


> <%@ Language=VBScript%>
>>>>>>> <%'get header info
>>>>>>> Response.Write Request.ServerVariables("HTTP_USER_AGENT")
>>>>>>>
>>>>>>> 'detect javascript
>>>>>>>
>>>>>>> <%
>>>>>>> Browser Name: <%=bc.browser %>
>>>>>>> Browser Version: <%=bc.version%>
>>>>>>> set bc=nothing
>>>>>>>
>>>>>>> %>


All of the above is immaterial to your question. Leave it out of your post.


>>>>>>> Set bc = Server.CreateObject("MSWC.BrowserType")
>>>>>>> if (bc.javascript = FALSE) then
>>>>>>> response.write("no javascript")
>>>>>>> response.Redirect("Test.html")
>>>>>>> else
>>>>>>> response.write("has javascript")
>>>>>>> end if


The problem with your above approach is that it will not work as expected
unless you keep your browsercap.ini file updated. You will eventually come
to understand that this is more trouble than it is worth, so STOP USING
MSWC.BrowserType NOW.
http://aspfaq.com/show.asp?id=2199

Once you come to terms with this, you should come back and apologize to
Aaron. His initial response was helpful and to the point.



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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript Browser Sniffer trpost@gmail.com Javascript 4 04-13-2006 08:05 AM
browser sniffer Paul Watt HTML 12 07-07-2005 01:41 AM
asp based browser sniffer that detects if browser supports css AMC ASP General 12 01-13-2005 09:50 PM
Rollover image work in Netscape 7 but not work in Internet Explorer 6 Koh Javascript 2 05-11-2004 05:54 PM
Creating browser sniffer with ASP.Net =?Utf-8?B?RGF2aWQgQmFrZXI=?= ASP .Net 5 05-03-2004 09:56 PM



Advertisments