2 out of 3 rated this helpful - Rate this topic

decodeURIComponent Function (JavaScript)

JavaScript - Internet Explorer 10

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

decodeURIComponent(encodedURIString)

The required encodedURIString argument is a value representing an encoded URI component.

A URIComponent is part of a complete URI.

If the encodedURIString is not valid, a URIError occurs.

The following code first encodes and then decodes a URI.

var uriEncode = encodeURI ("http://www.Not a URL.com");
var uriDecode = decodeURIComponent(uriEncode);

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

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

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Also supported in Windows Store apps. See Version Information.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.