|
|
Detecting the visitor's browser in javascript - Javascript
|
Views : 747
|
|
Tagged in : Javascript
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Detecting the visitor's browser in javascript
There are different types of browsers with different versions used by the visitor to access a website. For a server side program there is nothing to do or special care to be taken as the code remains in severs side. However for client side tags or scripts as they gets executed at visitor end they have to give equal output for different browsers used by visitors.
Here is the code to display details about the browser
<table width='100%' border='0' cellspacing='1' cellpadding='0'>
<script type="text/javascript">
var st;
st="<tr><td class=data>UserAgent </td><td class=data>"+ navigator.userAgent + "</td></tr>";
st=st + "<tr><td class=data>appName </td><td class=data>"+ navigator.appName + "</td></tr>";
st=st + "<tr><td class=data>appVersion</td><td class=data>"+ navigator.appVersion + "</td></tr>";
st=st + "<tr><td class=data>browserLanguage</td><td class=data>"+ navigator.browserLanguage + "</td></tr>";
st=st + "<tr><td class=data>platform</td><td class=data>"+ navigator.platform + "</td></tr>";
document.write(st);
</script>
</table> |
|
By Nithya, On - 2011-03-15 |
|
|
|