Javascript - Global decodeURI() Function

The decodeURI() function can decode a URI.

Description

The decodeURI() function can decode a URI.

Syntax

decodeURI(uri)

Parameter Values

Parameter Require Description
uri Required. The URI to be decoded

Return

A String, representing the decoded URI

Example

Decode a URI after encoding it:

Demo

//decode a URI after encoding it.

var uri = "my test.asp?name=stale&lang=java";
var enc = encodeURI(uri);
var dec = decodeURI(enc);
var res = "Encoded URI: " + enc + "\n" + "Decoded URI: " + dec;
console.log(res);//from   w w  w  . j a  v  a 2 s.  c o m

Result