decodeURI()
decodeURI() 함수는 encodeURI이나 비슷한 루틴으로 사전에 만들어진 URI(Uniform Resource Identifier, 인터넷식별자) 를 해독합니다.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
구문
decodeURI(encodedURI)파라미터
encodedURI- 완전하고 암호화된 인터넷식별자(URI)
리턴 값
주어진 암호화된 URI의 암호화되지 않은 버전을 나타내는 새 문자열을 반환합니다.
예외
encodedURI에 유효하지 않은 문자열이 포함된 경우 URIError ("malformed URI sequence") 예외를 던집니다.
설명
암호화된 URI의 각 이스케이프 시퀀스(확장문자열)를 자신을 나타내는 문자로 바꾸지만 encodeURI에서 도입할 수 없었던 이스케이프 시퀀스는 해독하지 않습니다. "#"문자는 이스케이프 시퀀스에서 해독되지 않습니다.
예제
Decoding a Cyrillic URL
decodeURI('https://developer.mozilla.org/ru/docs/JavaScript_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B');
// "https://developer.mozilla.org/ru/docs/JavaScript_шеллы"
Catching errors
try {
var a = decodeURI('%E0%A4%A');
} catch(e) {
console.error(e);
}
// URIError: malformed URI sequence사양
| Specification | Status | Comment |
|---|---|---|
| ECMAScript 3rd Edition (ECMA-262) | Standard | Initial definition. |
| ECMAScript 5.1 (ECMA-262) The definition of 'decodeURI' in that specification. |
Standard | |
| ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'decodeURI' in that specification. |
Standard | |
| ECMAScript (ECMA-262) The definition of 'decodeURI' in that specification. |
Living Standard |
브라우저 호환성
BCD tables only load in the browser