JavaScript decodeURI()Function

函数参考手册JavaScript Global Functions

Definition and Usage

The decodeURI() function can decode a URI that was encoded by the encodeURI() function.

Tip:UseencodeURI()The function can encode the URI.

Syntax

decodeURI(uri)

Parameter Description
uri Required. A string containing the URI to be decoded or other text to be decoded.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The decodeURI() function is supported by all major browsers


Examples

Examples

Use decodeURI() to decode an encoded URI:

var uri="my test.php?name=ståle&car=saab"; document.write(encodeURI(uri)+ "<br>"); document.write(decodeURI(uri));

The output of the above example is:

my%20test.php?name=st%C3%A5le&car=saab
my test.php?name=ståle&car=saab

Try it yourself »


函数参考手册JavaScript Global Functions Other Extensions