Encodes a text string as a valid component of a Uniform Resource Identifier (URI).
SyntaxencodeURIComponent( encodedURIString )
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);
Remarks
The required encodedURIString argument is a value representing an encoded URI component.
The encodeURIComponent function returns an encoded URI. If you pass the result to decodeURIComponent , the original string is returned. Because the encodeURIComponent function encodes all characters, be careful if the string represents a path such as /folder1/folder2/default.html. The slash characters will be encoded and will not be valid if sent as a request to a web server. Use the encodeURI function if the string contains more than a single URI component.
See also Other articles AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4