我如何获取当前的加密URL Base64

问题描述 投票:1回答:2

我想通过解码Base64提取当前URL,或者它可以正常工作而不解码它

我的编码器网址是:

www.site.com/search?cT1pZnJhbWUmb3E9aWZyYW1lJmFxcz1jaHJvbWUuLjY5aTU3ajY5aTU5ajY5aTY1bDNqNjlpNjBzMJV

<p id="lin"></p>

<script>
document.getElementById("lin").innerHTML =
"url: " + window.location.href;
</script>

必须解密

url:https://www.google.com/search?q=iframe&oq=iframe&aqs=chrome..69i57j69i59j69i65l3j69i60l3.1478248423j0j0&sourceid=chrome&ie=UTF-8
javascript html url base64
2个回答
0
投票

<p id="lin"></p>
<script>
document.getElementById("lin").innerHTML =
"url: " + window.location.hostname + "?" + (atob( window.location.search.split('&')[1]));
</script>

example


1
投票

您可能考虑使用atob()

atob()
let url = "www.site.com/search?cT1pZnJhbWUmb3E9aWZyYW1lJmFxcz1jaHJvbWUuLjY5aTU3ajY5aTU5ajY5aTY1bDNqNjlpNjBzMJV";

let parts = url.split("?");

document.querySelector("p").innerHTML = parts[0] + "?" + atob(parts[1]);
© www.soinside.com 2019 - 2024. All rights reserved.