[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent [Back]  [Original]

decodeURIComponent() - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

decodeURIComponent()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..

decodeURIComponent() Uniform Resource Identifier (URI), encodeURIComponent .

In this article

function containsEncodedComponents(x) {
  // ie ?,=,&,/ etc
  return decodeURI(x) !== decodeURIComponent(x);
}

console.log(containsEncodedComponents("%3Fx%3Dtest")); // ?x=test
// Expected output: true

console.log(containsEncodedComponents("%D1%88%D0%B5%D0%BB%D0%BB%D1%8B")); // 
// Expected output: false

decodeURIComponent(encodedURI)

encodedURI

, Uniform Resource Identifier.

, Uniform Resource Identifier (URI), .

URIError (" URI").

URI .

URL

js
decodeURIComponent("JavaScript_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B");
// "JavaScript_"

js
try {
  var a = decodeURIComponent("%E0%A4%A");
} catch (e) {
  console.error(e);
}

// URIError: malformed URI sequence

Specification
ECMAScript 2027 LanguageSpecification
# sec-decodeuricomponent-encodeduricomponent


Web Proxy Viewer  |  New URL  |  Original Page