• Q&A
  • 회원가입
  • 로그인

[Global] JS - decodeURIComponent() 함수 - URI구성요소 디코딩 [전역함수]

decodeURIComponent() 예제

 

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


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


<script>

function homzzang() {

  var uri = "https://homzzang.com/b/js-359";

  var uri_enc = encodeURIComponent(uri);

  var uri_dec = decodeURIComponent(uri_enc);

  var res = "Encoded URI: " + uri_enc + "<br>" + "Decoded URI: " + uri_dec;

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

}

</script>

 

결과보기

결과값:

Encoded URI: https%3A%2F%2Fhomzzang.com%2Fb%2Fjs-359

Decoded URI: https://homzzang.com/b/js-359

 

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

찾아주셔서 감사합니다. Since 2012