Easy Tutorial
❮ Jsref Startswith Prop Email Value ❯

JavaScript decodeURIComponent() Function


Definition and Usage

The decodeURIComponent() function decodes a URI encoded by the encodeURIComponent() function.

Tip: Use the encodeURIComponent() method to encode a URI.

Syntax

Parameter Description
uri Required. A string containing an encoded URI component or other text to be decoded.

Browser Support

All major browsers support the decodeURIComponent() function.


Example

Decode an encoded URI using decodeURIComponent():

var uri = "https://www.tutorialpro.org/my test.php?name=ståle&car=saab";
var uri_encode = encodeURIComponent(uri);
document.write(uri_encode);
document.write("<br>");
document.write(decodeURIComponent(uri_encode));

The above example outputs:

https%3A%2F%2Fwww.tutorialpro.org%2Fmy%20test.php%3Fname%3Dst%C3%A5le%26car%3Dsaab
https://www.tutorialpro.org/my test.php?name=ståle&car=saab
❮ Jsref Startswith Prop Email Value ❯