encodeURIComponent() (Function)

This ECMA defined function can be used to encode a URI component value that can then be decoded with the decodeURIComponent() function.

Availability:

ECMAScript edition - 3
JavaScript - 1.5
JScript - 5.5
Internet Explorer - 5.5
Netscape - 6.0
Property/method value type:String primitive
JavaScript syntax:-encodeURIComponent(aComponent)
Argument list:aComponentA URI component to be encoded

The encodeURIComponent() function is used to encode individual components belonging to a URI. You will need to deconstruct the URI yourself if you intend to call this function from your own scripts.

See also:decodeURI(), decodeURIComponent(), encodeURI(), escape(), unescape(), URI handling functions

Cross-references:

ECMA 262 edition 3 - section - 15.1.3.4