The request
contains information about browser. When
we use request.getHeader in codes, we will get browser information .
The following
codes show us some information ;
request.getHeader("user-agent")
Mozilla/5.0 (Windows; U; Windows NT 6.1; tr; rv:1.9.2.15)
Gecko/20110303 Firefox/3.6.15.
The browser type is Mozilla , and the operation system is Windows
such as.
We want to get a
browser model so that we search Firefox or MSIE in that text.
If we find
Firefox in that text, our browser model is Mozilla or if we find MSIE , our
browser model is Microsoft İnternet Explorer.
On the other
hand; if we don’t find Firefox or MSIE ,
we use another browser to connect to the internet.
We use the
following codes to find our browser model.
<%
String userAgent
= request.getHeader("user-agent");
String browser =
"Bilinmiyor";
out.println(userAgent);
if (userAgent != null)
{
if (userAgent.indexOf("MSIE")
> -1)
{
browser = "Microsoft Internet
Explorer";
}
else if
(userAgent.indexOf("Firefox") > -1)
{
browser = "Mozilla Firefox";
}
}
out.println(browser);
%>