<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Browser Detection Using Javascript</title>
<script type="text/javascript">
function Browser()
{
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) alert('Opera');
if (agt.indexOf("staroffice") != -1) alert('Star Office');
if (agt.indexOf("webtv") != -1) alert('WebTV');
if (agt.indexOf("beonex") != -1) alert('Beonex');
if (agt.indexOf("chimera") != -1) alert('Chimera');
if (agt.indexOf("netpositive") != -1) alert('NetPositive');
if (agt.indexOf("phoenix") != -1) alert('Phoenix');
if (agt.indexOf("firefox") != -1) alert('Firefox');
if (agt.indexOf("safari") != -1) alert('Safari');
if (agt.indexOf("skipstone") != -1) alert('SkipStone');
if (agt.indexOf("msie") != -1) alert('Internet Explorer');
if (agt.indexOf("netscape") != -1) alert('Netscape');
if (agt.indexOf("mozilla/5.0") != -1) alert('Mozilla');
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}
</script>
</head>
<body onload="return Browser();">
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
No comments:
Post a Comment
Plz Share your comments...