encodeURI() (Function)

This ECMA defined function can be used to encode an entire URI value that can then be decoded with the decodeURI() 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:-encodeURI(aURI)
Argument list:aURIAn unencoded URI

The encodeURI() function computes a new version of the string value it is passed. The new version has certain characters replaced with hexadecimal escape sequences. The string is expected to conform to the UTF-8 profile.

All character codes other than letters, numbers or a small set of special characters will be escaped.

These special characters are not transformed:

Note that the hash character is also not encoded by this function.

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

Cross-references:

ECMA 262 edition 3 - section - 15.1.3.3