I am trying to get information back on the vistors browser to my website. However the return I get for each parameter is 'undefined'.
The code I am using is below (this is referenced as external JS doc in the HTML head):
function navigator(){
alert("YOUR COMPUTER INFO SIR: \n\nBrowser Code Name: " + navigator.appCodeName + "\nBrowser Name: " + navigator.appName + "\nBrowser Version: " + navigator.appVersion + "\nCookies Enabled: " + navigator.cookieEnabled + "\nPlatform: " + navigator.platform + "\nUser-agent header: " + navigator.userAgent + "\nUser-agent language: " + navigator.systemLanguage );
}
I am calling the function in the HTML body as:
<input type="button" onclick="navigator()" value="Click Me to get your computer Info!"/>
And the data is returned as:
YOUR COMPUTER INFO SIR:
Browser Code Name: undefined
Browser Name: undefined
Browser Version: undefined
Cookies Enabled: undefined
Platform: undefined
User-agent header: undefined
User-agent language: undefined
Any ideas?
Update: Thanks, Renamed the function as suggested to navigatorInfo and got data returned as follows:
Browser Code Name: Mozilla Browser Name: Netscape Browser Version: 5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/536.29.13 (KHTML, like Gecko) Version/6.0.4 Safari/536.29.13 Cookies Enabled: true Platform: MacIntel User-agent header: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/536.29.13 (KHTML, like Gecko) Version/6.0.4 Safari/536.29.13 User-agent language: undefined.
However I am using a Safari browser and the Browser returned is Mozilla....
UPDATE: OK, got it, thanks for the help.... http://www.quirksmode.org/js/detect.html