X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript encodeURI() Function

Function Reference JavaScript Global Functions

Example

Encode a URI:

var uri = "my test.asp?name=ståle&car=saab";
var res = encodeURI(uri);

The result of res will be:

my%20test.asp?name=st%C3%A5le&car=saab

Try it yourself »


Definition and Usage

The encodeURI() function is used to encode a URI.

This function encodes special characters, except: , / ? : @ & = + $ # (Use encodeURIComponent() to encode these characters).

Tip: Use the decodeURI() function to decode an encoded URI.


Browser Support

Function
encodeURI() Yes Yes Yes Yes Yes


Syntax

encodeURI(uri)

Parameter Values

Parameter Description
uri Required. The URI to be encoded

Technical Details

Return Value: A String, representing the encoded URI


Function Reference JavaScript Global Functions

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook