The decodeURI() function can decode a URI.
The decodeURI() function can decode a URI.
decodeURI(uri)
Parameter | Require | Description |
---|---|---|
uri | Required. | The URI to be decoded |
A String, representing the decoded URI
Decode a URI after encoding it:
//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 www.ja v a 2s. c om*/