JavaScript Window Navigator
window.navigator 객체는 방문자의 브라우져 정보들을 포함하고 있다.
Window Navigator
window.navigator 객체는 window 접두어(prefix)를 생략하고 사용할 수 있다.
Example
<div id="example"></div>
<script>
txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt+= "<p>Browser Name: " + navigator.appName + "</p>";
txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";
txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt+= "<p>Platform: " + navigator.platform + "</p>";
txt+= "<p>User-agent header: " + navigator.userAgent + "</p>";
txt+= "<p>User-agent language: " + navigator.systemLanguage + "</p>";
document.getElementById("example").innerHTML=txt;
</script>
<script>
txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt+= "<p>Browser Name: " + navigator.appName + "</p>";
txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";
txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt+= "<p>Platform: " + navigator.platform + "</p>";
txt+= "<p>User-agent header: " + navigator.userAgent + "</p>";
txt+= "<p>User-agent language: " + navigator.systemLanguage + "</p>";
document.getElementById("example").innerHTML=txt;
</script>
Try it yourself »
Navigator Object Properties
| Property | Description |
|---|---|
| appCodeName | 브라우져의 code name 반환 |
| appName | 브라우져의 name 반환 |
| appVersion | 브라우져의 version 반환 |
| cookieEnabled | 브라우져가 cookie 사용이 가능한지 반환 |
| onLine | browser가 온라인이면 true, 아니면 false. |
| platform | browser 가 컴파일된 플랫폼 반환 |
| userAgent | user-agent 헤더 반환 |
Navigator Object Methods
| Method | Description |
|---|---|
| javaEnabled() | java 사용한지 반환 |
| taintEnabled() | 데이터 tainting 가능 여부 반환 |
'프로그래밍 > JavaScript' 카테고리의 다른 글
| JavaScript 배열 객체, Array (2) | 2013.01.05 |
|---|---|
| JavaScript History 객체 (0) | 2013.01.05 |
| JavaScript Location 객체 (0) | 2013.01.05 |
| JavaScript 스크린 객체 (0) | 2013.01.05 |
| JavaScript 브라우저 객체 모델 BOM (2) | 2013.01.05 |
| JavaScript 수학 객체 Math (0) | 2013.01.05 |
| JavaScript 논리 객체, boolean (0) | 2013.01.05 |
| JavaScript 문자열 객체 (1) | 2013.01.04 |