JavaScript encodeURIComponent() functie
- Previous page encodeURI()
- Next page escape()
- Go up one level JavaScript global reference manual
Definitie en gebruik
encodeURIComponent()
De functie codiert URI-componenten.
Deze functie codiert speciale tekens. Bovendien codiert het ook de volgende tekens: , / ? : @ & = + $ #
Tip:Gebruik decodeURIComponent()
De functie decodeURIComponent() ontcodeert URI-componenten.
Voorbeeld
Codeer de URI:
var uri = "https://codew3c.com/my test.asp?name=stale&car=saab"; var res = encodeURIComponent(uri);
Syntaxis
encodeURIComponent(uri)
Parameterwaarde
Parameter | Beschrijving |
---|---|
uri | Noodzakelijk. De te coderen URI. |
Technical details
Return value: | String representing the encoded URI. |
---|
Browser support
Function | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
encodeURIComponent() | Support | Support | Support | Support | Support |
- Previous page encodeURI()
- Next page escape()
- Go up one level JavaScript global reference manual