encodeURI() global function
     
    JS Home  << 
    JS Reference  << 
    encodeURI()
  
  Global function URI encoding.
Description
Encodes the special characters of a passed uri except the following:
 ; , / ? : @ & = + $ #
  Syntax
| Signature | Description | 
|---|---|
| encodeURI(uri) | Decodes any special characters of an encoded uri including components. | 
Parameters
| Parameter | Description | 
|---|---|
| uri | The uri to encode. | 
Below is an example of using the encodeURI() function.
// Encode a uri 
var uri="a spurious name.com?firstname=barney&surname=magrew";
  
alert(encodeURI(uri));  
Related Tutorials
JavaScript Advanced Tutorials - Lesson 9 - Any Other Business
