Description
The decodeURI() function is used to decode a URI.
This method has the form:
decodeURI(uri)
Parameter | Description |
---|---|
uri | (required) The URI to be decoded |
Examples
The following example shows the basic use of this method.
<script>
var uri = "ex.com/my test/index.html";
document.write(encodeURI(uri));
document.write("<br />");
document.write(decodeURI(uri));
</script>
This produces the following result:
Browser Support
Firefox | IE | Chrome | Opera | Safari |
---|---|---|---|---|
Description
The encodeURI() function is used to encode a URI.
This function encodes special characters, except: , / ? : @ & = + $ # (Use encodeURIComponent() to encode these characters).
This method has the form:
encodeURI(uri)
Parameter | Description |
---|---|
uri | (required) The URI to be encoded |
Examples
The following example shows the basic use of this method.
<script>
var uri = "ex.com/my test/index.html";
document.write(encodeURI(uri));
document.write("<br />");
document.write(decodeURI(uri));
</script>
This produces the following result:
Browser Support
Firefox | IE | Chrome | Opera | Safari |
---|---|---|---|---|