decodeURIComponent-1

 

This decodeURIComponent() function decodes a Uniform Resource Identifier (URI) means it will remove all the escape sequences in the provided URI which was encoded using encodeURIComponent. See the code snippet:

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <button onclick="decryptUriComponent()">Original uri component</button> <p id="sample"></p> <script> function decryptUriComponent() { var uri = "http://LearnKode.com/my page.asp?name=ståle&car=saab"; var enc = encodeURIComponent(uri); var dec = decodeURIComponent(enc); var result = "Encoded URI: " + enc + "<br>" + "Decoded URI: " + dec; document.getElementById("sample").innerHTML = result; } </script> </body> </html>
Output