모든 객체가 소속된 객체이며, 브라우저 창을 의미한다
window는 생략이 가능하다
useEffect(() => {
const handleMessage = event => {
if(event.origin === window.location.origin){
if(evnet.data.key === 'test'){
refetchData();
}
}
}
window.addEventListener('message', handleMessage);
return () => {
window.removeEventListener('message', handleMessage);
}
},[reqbody])
window.open('www.dddd.com')
window.close()
window.alert('')
open('www.dddd.com')
close()
alert('')
현재문서에 대한 정보를 갖고 있는 객체
document.qeurySelector('#ss').textContent='원하는 텍스트'
현재의 브라우저가 접근했던 URL history를 제어할 수 있다
브라우저의 뒤로가기 앞으로가기의 기능과 유사하다
history.back()
history.forward()
문서의 주소와 관련된 객체로 window객체의 프로퍼티인 동시에 document의 프로퍼티이다
이 객체를 이용하여 윈도우의 문서 URL을 변경할 수 있고,
문저의 위치와 관련해서 다양한 정보를 얻을 수 있다
window.location(o)
document.location(o)
location.host //홈페이지의 host
location.href='www.google.com'
실행중인 애플리케이션에 대한 정보를 알 수 있다
크로스 브라우징 이슈를 해결할때 사용할 수 있다
사용자의 위치를 가져올 때에도 유용하게 사용된다