Browser Capability

Discussion in 'ASP General' started by Prabhat, Sep 29, 2005.

  1. Prabhat

    Prabhat Guest

    Hi All,

    I have IE6.0 SP1 and I executed one asp file with the below script to check
    the browser capability but see the result below the script...Copied from
    MSDN :)

    <% Set bc = Server.CreateObject("MSWC.BrowserType") %>
    Browser: <%= bc.browser %><BR>
    Version: <%= bc.version %><BR>
    Supports frames?
    <% If (bc.frames = "true") then %>
    Yes<BR>
    <% Else %>
    No<BR>
    <% End If %>
    Supports tables?
    <% If (bc.tables = "true") then %>
    Yes<BR>
    <% Else %>
    No<BR>
    <% End If %>
    Supports background sounds?
    <% If (bc.BackgroundSounds = "true") then %>
    Yes<BR>
    <% Else %>
    No<BR>
    <% End If %>
    Supports VBScript?
    <% If (bc.vbscript = "true") then %>
    Yes<BR>
    <% Else %>
    No<BR>
    <% End If %>
    Supports JavaScript?
    <% If (bc.javascript = "true") then %>
    Yes<BR>
    <% Else %>
    No<BR>
    <% End If %>


    OUTPUT:

    Browser: Netscape
    Version: 4.00
    Supports frames? No
    Supports tables? No
    Supports background sounds? No
    Supports VBScript? No
    Supports JavaScript? No

    why does the answeres shows wrong value while the IE6 supports all.

    Thanks
    Prabhat
     
    Prabhat, Sep 29, 2005
    #1
    1. Advertising

  2. Prabhat

    Danny@Kendal Guest

    "Prabhat" <> wrote in message
    news:...
    > Hi All,
    >
    > I have IE6.0 SP1 and I executed one asp file with the below script to
    > check
    > the browser capability but see the result below the script...Copied from
    > MSDN :)
    >
    > <% Set bc = Server.CreateObject("MSWC.BrowserType") %>
    > Browser: <%= bc.browser %><BR>
    > Version: <%= bc.version %><BR>
    > Supports frames?
    > <% If (bc.frames = "true") then %>
    > Yes<BR>
    > <% Else %>
    > No<BR>
    > <% End If %>


    <snip>

    > why does the answeres shows wrong value while the IE6 supports all.


    Because you're testing for a string value of "true" rather than the boolean
    value of TRUE.
    Change "true" to true or remove the ="true" part completely.

    ie:
    <%if (bc.frames) then%>
    Yes<br>
    <%else%>
    No<br>
    <%end if%>
     
    Danny@Kendal, Sep 29, 2005
    #2
    1. Advertising

  3. Prabhat

    Prabhat Guest

    "Danny@Kendal" <> wrote

    > Because you're testing for a string value of "true" rather than the

    boolean
    > value of TRUE.
    > Change "true" to true or remove the ="true" part completely.
    >
    > ie:
    > <%if (bc.frames) then%>
    > Yes<br>
    > <%else%>
    > No<br>
    > <%end if%>
    >


    Ok. you are right...

    But now i have rectified that and got the below result.

    Browser: Netscape
    Version: 4.00
    Supports frames? Yes
    Supports tables? Yes
    Supports background sounds? No
    Supports VBScript? No
    Supports JavaScript? Yes

    It says NO to VBS and Sound ? also the browser is Netscape ? are these
    correct?

    Thanks
    Prabhat
     
    Prabhat, Sep 29, 2005
    #3
  4. Prabhat

    Danny@Kendal Guest

    "Prabhat" <> wrote in message
    news:%...
    >
    > "Danny@Kendal" <> wrote
    >
    >> Because you're testing for a string value of "true" rather than the

    > boolean
    >> value of TRUE.
    >> Change "true" to true or remove the ="true" part completely.
    >>
    >> ie:
    >> <%if (bc.frames) then%>
    >> Yes<br>
    >> <%else%>
    >> No<br>
    >> <%end if%>
    >>

    >
    > Ok. you are right...
    >
    > But now i have rectified that and got the below result.
    >
    > Browser: Netscape
    > Version: 4.00
    > Supports frames? Yes
    > Supports tables? Yes
    > Supports background sounds? No
    > Supports VBScript? No
    > Supports JavaScript? Yes
    >
    > It says NO to VBS and Sound ? also the browser is Netscape ? are these
    > correct?


    Right, I'll try again now the work Internet connection is work....
    Damn! There it goes again for the brazillionth time this week.
    Oh! It's back up so I'd better type quickly.

    If I set Opera to identify as Internet Explorer then I get the same results.
    If I set it to identify as itself I get a more accurate result.

    Personally I wouldn't bother trying to work out what browser is being used.
    It's not reliable.
     
    Danny@Kendal, Sep 30, 2005
    #4
    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. Novice
    Replies:
    5
    Views:
    511
  2. bj daniels

    adding a search capability

    bj daniels, Aug 14, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    440
    bj daniels
    Aug 20, 2003
  3. Chris Welch
    Replies:
    1
    Views:
    326
    S. Justin Gengo
    Nov 25, 2003
  4. =?Utf-8?B?Qkc=?=
    Replies:
    0
    Views:
    808
    =?Utf-8?B?Qkc=?=
    Dec 27, 2004
  5. Seymour
    Replies:
    7
    Views:
    605
Loading...

Share This Page