Encode a URI:
The result of res will be:
The encodeURIComponent() function encodes a URI component.
This function encodes special characters. In addition, it encodes the following characters: , / ? : @ & = + $ #
Tip: Use the decodeURIComponent() function to decode an encoded URI component.
Function | |||||
---|---|---|---|---|---|
encodeURIComponent() | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
uri | Required. The URI to be encoded |
Return Value: | A String, representing the encoded URI |
---|