### 주소 가져오기 href

<!DOCTYPE html>
<html>
<head>
</head>
<body>
	<script type="text/javascript">
    	console.log(location.toString(), location.href);
    </script>
</body>
</html>

### 링크의 분석을 해보자

console.log(location);
// 출력 : https://opentutorials.org/module/904/6634?id=10#bookmark

console.log(
	location.protocol, // 'http:' 이게 프로트콜
	location.host, // 'opentutorials.org' 이거
    location.port, // '8080' 도매인 뒤에 있음 
    location.pathname,  // 'module/904/6634' 구체적인 위치
    location.search, // '?id=10' 
    location.hash // '#bookmark'  
    )

###  리로딩 

location.href = 'http://egoing.net';
// 이곳으로 보넴

location.reload();
//현제 웹페이지를 리로드함

location.href = 'location.href'
이또한 같다

'HTML 참고서 > HTML 생활코딩 Youtube' 카테고리의 다른 글

7. JavaScript 창제어  (0) 2020.04.12
6. JavaScript Navigator  (0) 2020.04.12
4.Javascript 객체  (0) 2020.04.10
3. JavaScript 사용자와 커뮤니케이션  (0) 2020.04.10
2. Java Script 구조에 대하여(HTML)  (0) 2020.04.10
블로그 이미지

Or71nH

,