JavaScript encodeURI() Function
- Halaman sebelumnya decodeURIComponent()
- Halaman berikutnya encodeURIComponent()
- Kembali ke tingkat atas Panduan Referensi Global JavaScript
Definition and usage
encodeURI()
Function used to encode URI.
This function encodes special characters, except: , / ? : @ & = + $ # (use encodeURIComponent() to encode these characters).
Tip:Use decodeURI()
Function to decode URI that has been encoded.
Example
Encode URI:
var uri = "my test.asp?name=ståle&car=saab"; var res = encodeURI(uri);
Syntax
encodeURI(uri)
Parameter value
Parameter | Description |
---|---|
uri | Required. The URI to be encoded. |
Technical details
Return value: | String, represents the encoded URI. |
---|
Browser Support
Fungsi | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
encodeURI() | Dukungan | Dukungan | Dukungan | Dukungan | Dukungan |
- Halaman sebelumnya decodeURIComponent()
- Halaman berikutnya encodeURIComponent()
- Kembali ke tingkat atas Panduan Referensi Global JavaScript