JavaScript: Encode URL, Escape String

By Xah Lee. Date: . Last updated: .
encodeURI/decodeURI
Changes illegal URL characters to percent encoded form. [see encodeURI]
encodeURIComponent/decodeURIComponent
Like encodeURI but changes more chars, including slash and colon in http://. [see encodeURIComponent]
escape/unescape
deprecated. Changes some characters to a percent encoded form of the char's Unicode codepoint. [see escape]

Note: these functions are properties of the Global Object .

JS in Depth
XAH  BUY NOW