- window : 모든 객체가 소속된 객체이며, 브라우저 창 자체를 의미로 생략이 가능함
window.alert('Hello!');
alert('Hello!'); // window를 생략 가능
- document : 현재 문서에 대한 정보를 갖고 있는 객체
document.querySelector('#id').textContent = 'id의 텍스트 변경';
- history : 현재의 브라우저가 접근했던 URL history를 제어 (ex. 뒤로가기 버튼)
history.back(); // 뒤로 가기
history.forward(); // 앞으로 가기
- location : window 객체의 프로퍼티인 동시에 document의 프로퍼티로, 문서 URL 변경 및 위치와 관련한 정보를 얻을 수 있음
// window, document 둘 다 사용 가능
window.location
document.location
// 웹 문서 URL 정보 가져오기
location.host
// 웹 문서 주소 변경
location.href = '변경할 주소 입력'
- screen : 사용자의 디스플레이 화면에 대한 정보를 가지고 있는 객체
// 현재 디스플레이 정보
console.dir(screen)
- navigator : 실행 중인 애플리케이션에 대한 정보를 알 수 있음
// 현재 애플리케이션에 대한 위치 정보
navigator.geolocation.getCurrentPosition()
// 앱(브라우저) 이름
navigator.appName
// 앱(브라우저) 버전 정보
navigator.appVersion
// 서버에 요청할 때 앱(브라우저)에 대한 정보
navigator.userAgent
댓글