프로그래밍/Front end
[Front end] Javascript 웹 브라우저 현재 URL 확인
Reference M1
2020. 1. 14. 22:53
Javascript로 웹 페이지의 URL을 가져오는 방법을 알아보자.
// 현재 페이지의 URL 반환
window.location.href
// 웹 호스트의 도메인명 반환
window.location.hostname
// 현재 페이지의 경로와 파일 이름 반환
window.location.pathname
// 새 document 로드
window.location.assign