This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

decodeURI

Summary

Gets the unencoded version of an encoded Uniform Resource Identifier (URI).

Syntax

decodeURI( URIstring )

Examples

The following code first encodes a URI component and then decodes it.

var uriEncode = encodeURIComponent ("www.Not a URL.com");
 var uriDecode = decodeURIComponent(uriEncode);

 document.write (uriEncode);
 document.write ("<br/>");
 document.write (uriDecode);

 // Output:
 // www.Not%20a%20URL.com
 // www.Not a URL.com

Remarks

The required URIstring argument is a value representing an encoded URI.

Use the decodeURI function instead of the deprecated unescape function.

The decodeURI function returns a string value.

If the URIString is not valid, a URIError occurs.

Applies To : Global Object

See also

Other articles

Attributions

  • Microsoft Developer Network: Article