반응형

출처: http://soke.tistory.com/14


alert(document.URL);

alert(document.location);

alert(document.location.href);


세가지 다 현재 URL 정보를 얻는스크립트입니다.


document.URL= "http://google.com";

document.location = "http://daum.net";

document.location.href = "http://naver.com";



document.URL에 "http://google.com"을 입력했는데요.

다시 alert(document.URL); 를 작성하여 현재 URL을 확인하여 보면 입력한 값과 다르게, 현재 URL이 나오는 것을 확인할 수 있습니다.


document.location = "http://daum.net";

document.location.href = "http://naver.com";

이 두개는 W3C에 따르면 동일합니다. 입력과 동시에 입력한 주소로 이동하게 됩니다.



반응형

'프로젝트 관련 조사 > ' 카테고리의 다른 글

Burp Suite 사용법 정리  (0) 2016.06.20
document.URL.indexOf()  (0) 2016.06.20
자바스크립트 변수 확인 방법  (0) 2016.06.18
[PHP] substr() 함수  (0) 2016.06.18
[PHP] - Str_replace 함수 사용법  (0) 2016.06.18

+ Recent posts