• 회원가입
  • 로그인
  • 구글아이디로 로그인

[DOM_Document] JS - document.URL 속성 - 웹문서주소 (= document.URL속성 = 다큐먼트유알엘속성/도큐먼트유알엘속성)

목차
  1. document.URL 예제 - 웹문서 URL 주소 반환
  2. document.URL 정의
  3. document.URL 구문
  4. document.URL 예제 - 웹문서 URL 주소 출력

 

document.URL 예제 - 웹문서 URL 주소 반환 

 

<button onclick="homzzang()">클릭</button>

 

<p id="demo"></p>

 

<script>

function homzzang() {

  var x = document.URL;

  document.getElementById("demo").innerHTML = x;

}

</script>

 

결과보기

 

document.URL 정의

 

웹문서 URL 주소 반환.

 


 

1. cf.

window.location.href (= 또는, location.href)

 

2.

IE9 이상 주요 최신 브라우저 모두 지원.

 

3. MDN document.URL 매뉴얼

https://developer.mozilla.org/en-US/docs/Web/API/Document/URL

 

 

document.URL 구문

 

document.URL

 


[반환값]

 

프로토콜 (예: https://) 포함한 웹문서의 전체 URL 주소 반환. (※ string 타입)

 

 

document.URL 예제 - 웹문서 URL 주소 출력

 

<p id="demo"></p>


<script>

let url = document.URL;

document.getElementById("demo").innerHTML = url;

// 결과값 예: http://localhost/

</script>

 

 

방문 감사합니다. (즐겨찾기 등록: Ctrl + D)

분류 제목
DOM_Document JS - implementation 속성 - DOMimplementation (돔구현객체)를 Document…
DOM_Document JS - importNode() 메서드 ★ - 다른문서의 노드복사해서 가져오기 (IE9 이상) ※ 아이프레임…
DOM_Document JS - inputEncoding 속성 - 입력인코딩문자셋 (= 입력인코딩언어셋) 반환 (IE9 이상)
DOM_Document JS - lastModified 속성 - 최종수정시간 (= 마지막수정시간) 반환 [읽기전용]
DOM_Document JS - links 속성 - href 속성 갖은 (앵커태그 + 에어리어태그) 링크태그집합
DOM_Document JS - normalize() 메서드 - 공백제거후, 인접텍스트노드 합치기 (document경우)
DOM_Document JS - normalizeDocument() 메서드 - normalize() 메소드와 유사 (지원 X)
DOM_Document JS - open() 메서드 - 출력모드 열기
DOM_Document JS - querySelector() 메서드 ★ - 쿼리선택자 (= 문서 안 지정 선택자 중 첫번째 것만 =…
DOM_Document JS - querySelectorAll() 메서드 ★★★ - 일치요소 모두 선택 (= querySelecto…
DOM_Document JS - readyState 속성 - 현재웹문서 로딩상태 반환 (= readyState속성 = 레디스테이트속…
DOM_Document JS - referrer 속성 ★ - 접속경로 (= 리퍼러) 반환
DOM_Document JS - removeEventListener() 메서드 ★ - 이벤트핸들러를 웹문서에서 제거 (IE9 이상)
DOM_Document JS - renameNode() 메서드 - Element 및 Attr 유형의 노드 이름 변경 (지원 X)
DOM_Document JS - scripts -모든 스크립트태그 모음
DOM_Document JS - strictErrorChecking 속성 - 엄격한오류검사 설정/반환 (= 엄격한에러체크 = 스트릭…
DOM_Document JS - title - 타이틀 (=문서제목) 설정/반환
DOM_Document JS - document.URL 속성 - 웹문서주소 (= document.URL속성 = 다큐먼트유알엘속성/도…
DOM_Document JS - write() 메서드 - 내용쓰기 (= 내용입력) : 줄바꿈 X
DOM_Document JS - writeln() 메서드 - 내용쓰기 (= 내용입력) : 줄바꿈 X (= writeln메서드 = 라…
26/67
목록
찾아주셔서 감사합니다. Since 2012