How to use decodeURIComponent in JavaScript

This article describe about decodeURIComponent() Function in JavaScript.
  • 2578

decodeURIComponent() Function in JavaScript

This function is used to decodes a URI component.

Note: To encode the URI component use encodeURIComponent.

Syntax

decodeURIComponent(uri)

 

Parameter Description
uri Required. uri to decode.

Example

<!DOCTYPE html>

<html>

<body>

<script type="text/javascript">

    var uri = "https://dotnetheaven.com/default.aspx?name=ståle&car=raman";

    var uri_encode = encodeURIComponent(uri);

    document.write(uri_encode);

    document.write("<br />");

    document.write(decodeURIComponent(uri_encode));

</script>

</body>

</html>

 

Output

 

pic8.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.