encodeURIComponent() global functionS2C Home « Globals « encodeURIComponent()

Global function URI encoding.


Encodes the special characters of a passed uri including the following:

 ; , / ? : @ & = + $ #


Signature Description
encodeURIComponent(uri)Encodes the special characters of a passed uri.


Parameter Description
uriThe uri to encode.

Below is an example of using the encodeURIComponent() function.

// Encode a uri 
var uri="a spurious name.com?firstname=barney&surname=magrew";

Press the button below to action the above code:

Related Tutorials

JavaScript Advanced Tutorials - Lesson 9 - Any Other Business

go to home page Homepage go to top of page Top