목차
- history.length 예제 - 방문 이력 개수
- history.length 정의
- history.length 구문
history.length 예제 - 방문 이력 개수
<p id="hz"></p>
<script>
var h = history.length;
document.getElementById("hz").innerHTML = h;
</script>
history.length 정의
현재 브라우저창 history의 URL 개수 반환.
1.
- 현재페이지가 포함되어 있으므로 1 이상 반환.
- 현 브라우저 세션 상태에서 사용자가 방문한 페이지 개수 구할 때 유용.
2.
- Internet Explorer , Opera : 0부터 시작.
- Firefox, Chrome, Safari : 1부터 시작.
3.
4.
모든 브라우저가 지원.
5. MDN history.length 예제 더 보기
https://developer.mozilla.org/en-US/docs/Web/API/History/length
history.length 구문
history.length