With respect to URL encoding, JS has three functions.
There are three decoding methods, Escape,encodeuri,encodeuricomponent ().
There are three decoding methods, Unescapse,decodeuri,decodeuricomponent.
1, Escape () can not be used directly for URL encoding, its real function is to return a character Unicode encoding value. For example, "Spring Festival" return result is%u6625%u8282,,escape () not "+" coding is mainly used for Chinese character coding, now is not advocated for use. The corresponding decoding function is: unescapse
2, encodeURI () is a function that is really used to encode URLs in JavaScript. Encode the entire URL address, but to the special meaning of the symbol "; / ? : @ & = + $, # ", also not encoded. The corresponding decoding function is: decodeURI ().
3, encodeURIComponent () can encode "; / ? : @ & = + $, # "these special characters. The corresponding decoding function is: decodeURIComponent ().
If you want to pass the URL with the & symbol, use encodeURIComponent ()
JavaScript encodes and decodes the URL of a browser