Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript decodeURI() Function

JavaScript decodeURI() Function

Function Reference JavaScript Global Functions


Definition and Usage

The decodeURI() function decodes a URI encoded by the encodeURI() function.

Tip: Use encodeURI() The function can encode a URI.

Syntax

decodeURI(uri)

Parameters 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


Example

Example

Use decodeURI() to decode an encoded URI:

var

uri

=

"

my test.php?name=ståle&car=saab

"

;

document

.

write

(

encodeURI

(

uri

)

"


"

)

;

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 »


Function Reference JavaScript Global Functions