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

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

encodeURIComponent() 예제

 

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


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


<script>

function homzzang() {

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

  var res = encodeURIComponent(uri);

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

}

</script>

 

결과보기

결과값: https%3A%2F%2Fhomzzang.com%2Fb%2Fjs-359

 

 

참고 

https://opentutorials.org/course/50/190

 

jQuery URL Encoder

https://codepen.io/CSWApps/pen/LBkfH?

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

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