Browser Capability

P

Prabhat

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
 
D

Danny@Kendal

Prabhat said:
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 %>

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

Prabhat

Danny@Kendal said:
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
 
D

Danny@Kendal

Prabhat said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,832
Latest member
UtaHetrick

Latest Threads

Top