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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.