172
rated 0 times
[
174]
[
2]
/ answers: 1 / hits: 22605
/ 13 Years ago, sat, august 13, 2011, 12:00:00
Im developing a javaScript code and I want to determine the version and brand of the client's browser, here's the piece of code I'm using to do so :
var browserName ;
function BrowserCheckin ()
{
if(navigator.userAgent.indexOf(Mozilla) > 0 )
browserName = Mozilla ;
if (navigator.userAgent.indexOf(MSIE) > 0 )
browserName = InternetExplorer;
if (navigator.userAgent.indexOf(Chrome) > 0)
browserName= Google Chrome ;
if(navigator.userAgent.indexOf(Opera) > 0 )
browserName = Opera ;
document.write(<h1> + browserName + </h1>) ;
}
but when i run my code using Google Chrome , the useAgent property returns a string containting :
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like
Gecko) Chrome/12.0.742.112 Safari/534.30
But I don't get what that Mozilla/5.0 is doing there , anyone has any Idea ?
(and one more thing , I use Linux as my Operating System)
Thanks in advance :)
More From » navigator