Page 1 of 1

Detecting Browser Types

Posted: Fri Aug 22, 2003 10:49 pm
by SearchesLot
I would like to put the following metas into the html of search results

For IE browser:
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">

For Netscape browser:
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">

I know I can use the $HTTP_USER_AGENT to determine the browser but there are so many different user agents, is there any way to make sure it's just Netscape or IE? I assume I would use something like this:
<If $HTTP_USER_AGENT like "">
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
<Else>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</if>

Is there any other way to do it? Would it be better to do this in Apache instead?

Thank you for any assistance.
Gerry

Detecting Browser Types

Posted: Sat Aug 23, 2003 7:52 am
by John
The simplest way to detect IE is similar to what you have: <if $HTTP_USER_AGENT like 'msie'><$isie=1></if>
It can of course be fooled if the user sets their own user agent string.

I'm assuming that you will be sending different data to each browser as well if you are using different charsets?