asp page with browser sniffer doesn't work in Netscape

Discussion in 'ASP General' started by AMC, Jan 14, 2005.

  1. AMC

    AMC Guest

    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
    %>
     
    AMC, Jan 14, 2005
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:uFzgAMk#...
    > 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
    > %>
    >
    >
    >
    >
    >
     
    Aaron [SQL Server MVP], Jan 14, 2005
    #2
    1. Advertising

  3. AMC

    AMC Guest

    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]" <> wrote in message
    news:eg6GHAl%...
    > 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" <> wrote in message
    > news:uFzgAMk#...
    > > 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
    > > %>
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    AMC, Jan 14, 2005
    #3
  4. 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" <> wrote in message
    news:#RzvaIl#...
    > 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]" <> wrote in message
    > news:eg6GHAl%...
    > > 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" <> wrote in message
    > > news:uFzgAMk#...
    > > > 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
    > > > %>
    > > >
    > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Aaron [SQL Server MVP], Jan 14, 2005
    #4
  5. AMC

    AMC Guest

    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]" <> wrote in message
    news:%23tQqCLl%...
    > 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" <> wrote in message
    > news:#RzvaIl#...
    > > 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]" <> wrote in message
    > > news:eg6GHAl%...
    > > > 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" <> wrote in message
    > > > news:uFzgAMk#...
    > > > > 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
    > > > > %>
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    AMC, Jan 14, 2005
    #5
  6. Wow, you're a bad programmer AND an a**hole. Good job.

    *PLONK*




    "AMC" <> wrote in message
    news:#z0ctXl#...
    > 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], Jan 14, 2005
    #6
  7. AMC

    Bob Lehmann Guest

    >>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" <> wrote in message
    news:#z0ctXl#...
    > 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]" <> wrote in message
    > news:%23tQqCLl%...
    > > 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" <> wrote in message
    > > news:#RzvaIl#...
    > > > 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]" <> wrote in message
    > > > news:eg6GHAl%...
    > > > > 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" <> wrote in message
    > > > > news:uFzgAMk#...
    > > > > > 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
    > > > > > %>
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Bob Lehmann, Jan 14, 2005
    #7
  8. AMC

    Rasta Guest

    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%...
    > >>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" <> wrote in message
    > news:#z0ctXl#...
    > > 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]" <> wrote in message
    > > news:%23tQqCLl%...
    > > > 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" <> wrote in message
    > > > news:#RzvaIl#...
    > > > > 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]" <> wrote in message
    > > > > news:eg6GHAl%...
    > > > > > 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" <> wrote in message
    > > > > > news:uFzgAMk#...
    > > > > > > 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
    > > > > > > %>
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Rasta, Jan 14, 2005
    #8
  9. 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-us/iissdk/iis/ref_vbom_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.
     
    Dave Anderson, Jan 14, 2005
    #9
  10. 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.
     
    Dave Anderson, Jan 14, 2005
    #10
  11. AMC

    Morris Guest

    AMC wrote:
    > Well,
    >
    > Plenty of my users still have Netscape so this needs to work.
    >
    >

    The latest figures I saw suggest that less than 1.5% of users overall
    are using Netscape, and that figure is on a steady decline:
    http://www.w3schools.com/browsers/browsers_stats.asp
    So, apart from the very valid points made by Aaron, if you are spending
    more than 1.4% of your project development time on this problem, it
    would be time wasted in my book.

    Morris
     
    Morris, Jan 14, 2005
    #11
  12. Morris wrote:
    > The latest figures I saw suggest that less than 1.5% of users overall
    > are using Netscape, and that figure is on a steady decline:
    > http://www.w3schools.com/browsers/browsers_stats.asp
    > So, apart from the very valid points made by Aaron, if you are
    > spending more than 1.4% of your project development time on this
    > problem, it would be time wasted in my book.


    He did not say which version of Netscape. Since all versions over 5 are
    built on the Gecko engine, this could represent as much as 23.9% of the
    market (Firefox + Mozilla + Netscape 7), according to the January 2005
    figures on your referenced site. And the share of Gecko-based browsers has
    been growing every month for at least a year.


    --
    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.
     
    Dave Anderson, Jan 15, 2005
    #12
  13. AMC

    Morris Guest

    Dave Anderson wrote:
    > Morris wrote:
    >
    >>The latest figures I saw suggest that less than 1.5% of users overall
    >>are using Netscape, and that figure is on a steady decline:
    >>http://www.w3schools.com/browsers/browsers_stats.asp
    >>So, apart from the very valid points made by Aaron, if you are
    >>spending more than 1.4% of your project development time on this
    >>problem, it would be time wasted in my book.

    >
    >
    > He did not say which version of Netscape. Since all versions over 5 are
    > built on the Gecko engine, this could represent as much as 23.9% of the
    > market (Firefox + Mozilla + Netscape 7), according to the January 2005
    > figures on your referenced site. And the share of Gecko-based browsers has
    > been growing every month for at least a year.
    >
    >


    It could represent that number - true. However, since the OP referred to
    "Netscape", as opposed to "Mozilla" or "Firefox", I assumed he was
    referring to the versions that are declining.

    Just goes to illustrate that posters should ensure that they include
    *all* relevant information, including version numbers (and that those
    trying to reply shouldn't make assumptions - even though they may appear
    valid assumptions).

    Morris
     
    Morris, Jan 15, 2005
    #13
  14. AMC

    Adrienne Guest

    Gazing into my crystal ball I observed "AMC" <>
    writing in news:uFzgAMk#:

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


    In addition to what others have said, browser sniffing is not going to do
    you any good. One of reasons is that there are many, many browsers out
    there with many different engines, different capabilities, etc. Some
    browsers will identify themselves as other than what they are, Opera for
    example. Users can also turn javascript off if they so desire.

    So the only true way to test for javascript is something like:
    <head>
    <script type="text/javascript">
    location.href="somepage.htm"
    </script>
    </head>
    <body>
    <p>Your browser does not seem to have javascript enabled. Please check your
    browsers documentation to see if it is available and how to enable it.</p>

    Now, if the user never sees the above paragraph, then they have javascript
    enabled, otherwise, they don't. Simple.
    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne, Jan 17, 2005
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGF2aWQgQmFrZXI=?=

    Creating browser sniffer with ASP.Net

    =?Utf-8?B?RGF2aWQgQmFrZXI=?=, May 3, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    3,107
    =?Utf-8?B?RGF2aWQgQmFrZXI=?=
    May 3, 2004
  2. dex

    packet sniffer

    dex, Apr 8, 2005, in forum: Java
    Replies:
    0
    Views:
    423
  3. Paul Watt

    browser sniffer

    Paul Watt, Jul 6, 2005, in forum: HTML
    Replies:
    12
    Views:
    2,549
    dorayme
    Jul 7, 2005
  4. AMC
    Replies:
    12
    Views:
    383
    Roland Hall
    Jan 13, 2005
  5. Javascript Browser Sniffer

    , Apr 11, 2006, in forum: Javascript
    Replies:
    4
    Views:
    144
Loading...

Share This Page