The decodeURIComponent() function decodes a URI component.
The decodeURIComponent() function decodes a URI component.
decodeURIComponent(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 = "https://book2s.com/my test.asp?name=stale&lang=java"; var uri_enc = encodeURIComponent(uri); var uri_dec = decodeURIComponent(uri_enc); var res = "Encoded URI: " + uri_enc + "\n" + "Decoded URI: " + uri_dec; console.log(res);//w w w . j a v a 2s . com