0

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. I have javascript enabled in Netscape. Can someone tell me why this is happening? I know there are probably better ways to do this but I need to know what's wrong with this particular code

<%@ 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
%>

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by dexterz
0

ASP broswertype object is not 100% reliable in detectinging browser type and version. I would recmmend getting a third pary software such as browserHawk.


Dexter

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.