JavaScript_7강_2_★★★location 객체★★★

열라뽕따히·2024년 3월 8일

JavaScript

목록 보기
27/37

location 객체

  • 자바스크립트가 실행되고 있는 현재 웹 브라우저의 주소 창에 표시된 주소 값과 관련된 내용을 다루는 객체
  • 사용자 브라우저 주소 창의 url에 대한 정보(속성)의 새로고침 기능을 제공해주는 객체

location 객체의 주요 속성 및 함수

  • location.href
    : 브라우저 창의 url 값을 반환하는 속성
  • location.reload()
    : 브라우저 창에 새로 고침이 일어나게 하는 함수




=============================코드=============================

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">

	document.write(`url 정보 >>> ${location.href} <br/>`);

</script>
</head>
<body>

</body>
</html>

=============================실행=============================

0개의 댓글