1. Escape () cannot be used directly for URL encoding, and its true function is to return a Unicode encoded value of one character. For example, "Spring Festival" return result is%u6625%u8282,escape () not "+" encoding is mainly used for man code, now has not advocated the use of.
2. encodeURI () is a function that is really used to encode URLs in JavaScript. Encodes the entire URL address, but the symbol "/?:@&=+$,#" for the special meaning is not encoded. The corresponding decoding function is decodeURI ().
3. encodeURIComponent () can encode ";/?:@&=+$,#" these special characters. The corresponding decoding function decodeuricomponent (). If you want to pass the URL with & symbol, so use encodeURIComponent ()
Summary , there is a need to pass a "+" symbol in the foreground to the background, did not think of the backstage in the automatic decoding into a space, finally found in the URL "+" corresponding to the background is a space, the space in the foreground will automatically become + to the background, so start to "+" to encode, If you determine that there may be a "+" in the argument, the value is first encodeuricomponent () to encode it, to the background value will become "+".
The above JavaScript URL several coding methods are small parts to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.