YouTip LogoYouTip

Jsref Decodeuricomponent

```html JavaScript decodeURIComponent() Function | Rookie Tutorial

Rookie Tutorial -- Learning is not just about technology, but also about dreams!

JavaScript Reference Manual

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects


JavaScript decodeURIComponent() Function

Definition and Usage

The decodeURIComponent() function decodes a URI component encoded by the encodeURIComponent() function.

Note: If the URI component to be decoded is invalid, a URIError will be thrown.

Browser Support

All major browsers support the decodeURIComponent() function.

Syntax

decodeURIComponent(URI)

Parameter Values

ParameterDescription
URIRequired. A string containing the URI component to be decoded.

Return Value

A string representing the decoded URI component.

Technical Details

JavaScript Version:1.5

Example

Decode a URI component:

var uri = "%7B%22name%22%3A%22John%22%7D";
var decoded = decodeURIComponent(uri);
console.log(decoded); // Output: {"name":"John"}

More Examples

Decode a URI with special characters:

var uri = "https%3A%2F%2Fexample.com%2Fpath%3Fquery%3Dvalue%26name%3D%C3%A9";
var decoded = decodeURIComponent(uri);
console.log(decoded); // Output: https://example.com/path?query=value&name=Γ©

Related Pages

```
← Jsref EncodeuriJsref Decodeuri β†’