10 Replies - 4150 Views - Last Post: 09 October 2002 - 09:25 AM Rate Topic: -----

#1 Fygar  Icon User is offline

  • I liek milk!!1
  • member icon

Reputation: 3
  • View blog
  • Posts: 4,358
  • Joined: 28-March 02

Browser Checking

Posted 09 October 2002 - 08:05 AM

I want to check what browser type the client is using, And I don't want the version number in it either. How do I go along doing that?
Is This A Good Question/Topic? 0
  • +

Replies To: Browser Checking

#2 Koenie  Icon User is offline

  • What?!

Reputation: 0
  • View blog
  • Posts: 1,313
  • Joined: 08-July 02

Re: Browser Checking

Posted 09 October 2002 - 08:13 AM

I think that's possible with Javascript, can you use that in ASP???

Koenie
Was This Post Helpful? 0
  • +
  • -

#3 Fygar  Icon User is offline

  • I liek milk!!1
  • member icon

Reputation: 3
  • View blog
  • Posts: 4,358
  • Joined: 28-March 02

Re: Browser Checking

Posted 09 October 2002 - 08:15 AM

Needs to be in ASP. There is a Request.ServerVariables("HTTP_USER_AGENT") but it adds their OS, browser type, browser version, I only need the Browser Type.
Was This Post Helpful? 0
  • +
  • -

#4 Koenie  Icon User is offline

  • What?!

Reputation: 0
  • View blog
  • Posts: 1,313
  • Joined: 08-July 02

Re: Browser Checking

Posted 09 October 2002 - 08:19 AM

Sorry, then I can't help you, but wait.....

Is that variable a string? Maybe you can chop that string (if it is) in pieces and pick the one you want. Dunno how to do that in ASP, though.

Koenie
Was This Post Helpful? 0
  • +
  • -

#5 SlashRaid  Icon User is offline

  • Dream.In.Force

Reputation: 1
  • View blog
  • Posts: 2,421
  • Joined: 21-January 02

Re: Browser Checking

Posted 09 October 2002 - 08:21 AM

I assume you don't want to use PHP or Javascript?

If so:
<%
' ***************************************************************** '
' Determine browser type and set stylesheets using MS/IIS "MSWC"
' (Microsoft Browser Capabilities Component)

Set objBCap = Server.CreateObject("MSWC.BrowserType") 

'set a default for any browser 
     strBrowser = "other" ' WebTV, etc.
     strStyleSheet = "/css/other.css"

'find browser type and set variables to be used elsewhere
     If objBCap.Browser = "IE" And CInt(objBCap.Version) >= 3 Then 
          strBrowser = "explorer"
          strStyleSheet = "/css/explorer.css"
     End If 
     If objBCap.Browser = "Netscape" And CInt(objBCap.Version) >= 3 Then 
          strBrowser = "netscape"
          strStyleSheet = "/css/netscape.css"
     End If 
%>


<!-- And then load the stylesheet for the detected browser -->
<link rel="STYLESHEET" type="text/css" href="<%=strStyleSheet%>">
You should be able to remove the version easily, though I vaguely know ASP.

Code Credit: Thomas W. Krafft
Was This Post Helpful? 0
  • +
  • -

#6 SlashRaid  Icon User is offline

  • Dream.In.Force

Reputation: 1
  • View blog
  • Posts: 2,421
  • Joined: 21-January 02

Re: Browser Checking

Posted 09 October 2002 - 08:37 AM

What about browserObj?
Was This Post Helpful? 0
  • +
  • -

#7 SlashRaid  Icon User is offline

  • Dream.In.Force

Reputation: 1
  • View blog
  • Posts: 2,421
  • Joined: 21-January 02

Re: Browser Checking

Post icon  Posted 09 October 2002 - 08:40 AM

Or:
Was This Post Helpful? 0
  • +
  • -

#8 Fygar  Icon User is offline

  • I liek milk!!1
  • member icon

Reputation: 3
  • View blog
  • Posts: 4,358
  • Joined: 28-March 02

Re: Browser Checking

Posted 09 October 2002 - 08:51 AM

Thanks, slashy, I'll look into those more. As for now, I think I will use this:

If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") Then
	Width = "55%"
Else
	Width = "100%"
End If 



I'm lazy... hehe, this will work peachy for NS and IE for now.
Was This Post Helpful? 0
  • +
  • -

#9 SlashRaid  Icon User is offline

  • Dream.In.Force

Reputation: 1
  • View blog
  • Posts: 2,421
  • Joined: 21-January 02

Re: Browser Checking

Posted 09 October 2002 - 08:59 AM

*shrugs* :rolleyes:

Here's another if the customer is willing to add the extra cost. They seem to have quite a nice knowledge base for browser related items.
Was This Post Helpful? 0
  • +
  • -

#10 klewlis  Icon User is offline

  • cur tu me vexas?

Reputation: 8
  • View blog
  • Posts: 1,723
  • Joined: 09-November 01

Re: Browser Checking

Posted 09 October 2002 - 09:21 AM

Fygar, on Oct 9 2002, 10:51 AM, said:

Thanks, slashy, I'll look into those more. As for now, I think I will use this:

If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") Then
	Width = "55%"
Else
	Width = "100%"
End If 



I'm lazy... hehe, this will work peachy for NS and IE for now.

Be careful with the browser agent... IE6 doesn't seem to detect properly.

And MS hasn't seen fit to give us a better option.

I had a week's worth of headaches with my dynamic nav for this reason when I upgraded to IE6... it had worked perfectly in IE5.5 and broke entirely in 6 because IE6 was detecting as NS4 (ick...).
Was This Post Helpful? 0
  • +
  • -

#11 SlashRaid  Icon User is offline

  • Dream.In.Force

Reputation: 1
  • View blog
  • Posts: 2,421
  • Joined: 21-January 02

Re: Browser Checking

Posted 09 October 2002 - 09:25 AM

<%@ page language="C#" %> 
<%@ Import Namespace="System.Web" %> 
<html> 
    <head><title>Browser Capabilities</title></head> 
    <body> 
        ActiveX Controls:<%= Request.Browser.ActiveXControls %><br> 
        AOL:            <%= Request.Browser.AOL %><br> 
        Browser:        <%= Request.Browser.Browser%><br> 
        ClrVersion:        <%= Request.Browser.ClrVersion%><br> 
        Cookies:        <%= Request.Browser.Cookies%><br> 
        Crawler:        <%= Request.Browser.Crawler%><br> 
        JavaApplets:    <%= Request.Browser.JavaApplets%><br> 
        Javascript:        <%= Request.Browser.Javascript%><br> 
        MajorVersion:    <%= Request.Browser.MajorVersion%><br> 
        MinorVersion:    <%= Request.Browser.MinorVersion%><br> 
        Platform:        <%= Request.Browser.Platform%><br> 
        Type:            <%= Request.Browser.Type%><br> 
        VBScript:        <%= Request.Browser.VBScript%><br> 
        Version:        <%= Request.Browser.Version%><br> 
    </body> 
</html> 

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1