Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>Click the button to decode a URI after encoding it.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var uri = "http://w3schools.com/my test.asp?name=ståle&car=saab";
    var uri_enc = encodeURIComponent(uri);
    var uri_dec = decodeURIComponent(uri_enc);
    var res = "Encoded URI: " + uri_enc + "<br>" + "Decoded URI: " + uri_dec;
    document.getElementById("demo").innerHTML = res;
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy