Latest

recent

JavaScript decodeURIComponent() Function

Definition and Usage

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

Syntax

decodeURIComponent(URIstring)

Parameter Description
URIstring Required. The URI to be decoded


Example

In this example we use decodeURIComponent() to decode a URI after encoding it:

<script type="text/javascript">
var test1="http://www.google.com/js/";
document.write(encodeURIComponent(test1)+ "<br />");
document.write(decodeURIComponent(test1));
</script>

The output of the code above will be:

http%3A%2F%2Fwww.google.com%2Fjs%2F
http://www.google.com/js/
JavaScript decodeURIComponent() Function Reviewed by 1000sourcecodes on 03:43 Rating: 5
Powered by Blogger.