decodeURIComponent() global function JS Home  <<  JS Reference  <<  decodeURIComponent()

Global function URI component decoding.

Description

Decodes any special characters of an encoded uri including components.

Syntax

Signature Description
decodeURIComponent(encodedUriComponent)Decodes any special characters of an encoded uri including components.

Parameters

Parameter Description
encodedUriComponentThe uri component to decode.

Below is an example of using the decodeURIComponent() function.


// Encode and then decode a uri 
var uri="a spurious name.com?firstname=barney&surname=magrew";
  
alert(encodeURIComponent(uri));
alert(decodeURIComponent(uri));  

Press the button below to action the above code:

Related Tutorials

JavaScript Advanced Tutorials - Lesson 9 - Any Other Business