Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

encodeURIComponent

The encodeURIComponent() function of the Global object replaces most non-alphanumeric characters in a Uniform Resource Identifier with their UTF encoded versions. It works opposite the decodeURIComponent() function. To avoid converting acceptable URI symbols needlessly, use the encodeURI() function instead.

All except the following symbols will be converted: ! * ( ) _ ' . ~

SyntaxencodeURIComponent ( uri )

Parameters

uri The Uniform Resource Identifier to be affected.

Examples

var encoded = encodeURIComponent('http://www.website.com/name of file.html'); document.write( encoded ); /* http%3A%2F%2Fwww.website.com%2Fname%20of%20file.html */

JavaScript

Methods

addEventListeneralertaveragebackblurconcatcreatedecodeURIdecodeURIComponentencodeURIencodeURIComponentevaleveryfilterforwardgoisArrayisFiniteisNaNjoinparseFloatparseIntpoppushpushStatereducereplaceStatereverseshiftshuffleslicesomesortspliceunshiftwrite