|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi everyone,
i have this script in PHP that detects the browser of the visitor but i want to translate this to ASP. PHP Code:
thanks in advance! |
|
#2
|
|||
|
|||
|
Code:
If InStr(1, Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") then
Response.Write "IE"
Else
Response.Write "NOT IE"
End If
__________________
Life is Good |
|
#3
|
||||
|
||||
|
have a look at these links
http://www.krafft.com/scripts/frees...ct.asp?m=3&s=11 http://www.experts-exchange.com/Web...Q_23076286.html |
|
#4
|
|||
|
|||
|
Quote:
thank you my friend. it's working. |
|
#5
|
||||
|
||||
|
Hi
You have to use the Request.ServerVairables("HTTP_USER_AGENT") which will return the following for IE 7... Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727) You can then use... Code:
strBrowser = Request.ServerVairables("HTTP_USER_AGENT")
If InSrt(strBrowser, "MSIE7") > 0 Then
strUserBrowser = "IE 7"
Elseif InStr(strBrowser, "Mozilla/5.0") > 0 Then
strUserBrowser = "FireFox"
End if
You need to add an elseif for each browser user agent string.
__________________
Hope this advice helps.
If so please show your appreciation by adding reputation points (click gauge image on top right of this post).- Post your code - Post your errors - Be clear - Be courteous - AND PLEASE...Finalise your thread with a solution or confirmation that the last advice worked or failed. Visit My ASP Free Members Club Profile |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Detect the browser with ASP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|