URIDECODE

This commit is contained in:
Arti Zirk 2017-07-21 14:39:02 +03:00
parent 8f32672d6e
commit 07e569e894
2 changed files with 6 additions and 2 deletions

View File

@ -30,7 +30,7 @@
}
jsonObj = n;
jsonStr = JSON.stringify(jsonObj);
out.innerText = base + "?" + window.btoa(jsonStr);
out.innerText = base + "?" + window.encodeURIComponent(window.btoa(jsonStr));
}
</script>

View File

@ -47,7 +47,11 @@
</div>
<script>
var jsonStr = window.atob(window.location.search.slice(1));
var rawStr = window.location.search.slice(1);
if (rawStr.indexOf("%") !== -1) {
rawStr = window.decodeURIComponent(rawStr);
}
var jsonStr = window.atob(rawStr);
var jsonObj = JSON.parse(jsonStr);
var t1 = document.getElementById("t1");
t1.innerText = "Tere "+jsonObj+"!";