| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/encodeURI | [Back] [Original] |
Get to know MDN better
encodeURI() (URI) ( UTF-8 ) "" )
encodeURI(URI)
URIURI
(URI)
URI URI URI
http://username:password@www.example.com:80/path/to/file.php?foo=316&bar=this+has+spaces#anchor
encodeURI UTF-8
; , / ? : @ & = + $ |
|
- _ . ! ~ * ' ( ) |
|
# |
encodeURI HTTP GET POST URI XMLHTTPRequests "&", "+", "=" GET POST encodeURIComponent
- URIError
// - ok
console.log(encodeURI("\uD800\uDFFF"));
// "Uncaught URIError: URI malformed"
console.log(encodeURI("\uD800"));
// "Uncaught URIError: URI malformed"
console.log(encodeURI("\uDFFF"));
URL RFC3986 ( IPv6) URL ()
function fixedEncodeURI(str) {
return encodeURI(str).replace(/%5B/g, "[").replace(/%5D/g, "]");
}
| ECMAScript 2027 LanguageSpecification # sec-encodeuri-uri |
| Web Proxy Viewer | New URL | Original Page |