[javascript] location 객체 / navigator 객체
by mini_min[javascript] location 객체 / navigator 객체
✔️ location 객체
: 로케이션 객체는 현재 브라우저에 표시된 HTML 문서의 주소를 얻거나, 브라우저에 새 문서를 불러올 때 사용할 수 있다.
: window 객체의 location 프로퍼티와 document 객체의 location 프로퍼티에 같이 연결되어 있다.
: location 객체의 프로퍼티와 메소드를 이용하면, 현재 문서의 URL 주소를 다양하게 해석하여 처리할 수 있다.
: location 객체는 Location 인터페이스의 구현체이다.

function sub() { // location : 브라우저의 주소를 얻거나 다른 주소로 이동할 때 // 뒤로가기 가능 location.href = "https://www.naver.com" } function sub2() { // 뒤로가기 불가 location.replace("https://google.com") }
💡 href : 뒤로가기가 가능하지만, replace 는 뒤로가기가 불가
✔️ navigator 객체
: 브라우저 공급자 및 버전 정보 등을 포함한 브라우저에 대한 다양한 정보를 저장하는 객체이다.
: navigator 객체는 Navigator 인터페이스 구현 객체이다.

let a = navigator.userAgent; let b = navigator.language; console.log(a); console.log(b);
블로그의 정보
개발자 미니민의 개발로그
mini_min