JS解码base64后跳转URL

咔咔猪
2024-04-27 / 0 评论 / 113 阅读

解码后直接跳

const encodedString = 'aHR0cHM6Ly93d3cua2twaWcuY24v';// 本站地址
const decodedString = atob(encodedString.replace('-', '+').replace('_', '/'));
window.location.href = decodedString;

解码后5秒跳

const encodedString = 'aHR0cHM6Ly93d3cua2twaWcuY24v';
const decodedString = atob(encodedString.replace('-', '+').replace('_', '/'));
setTimeout(() => {
  window.location.href = decodedString;
}, 5000); 

加id点击跳
<a id="redirectLink">点这里跳转 </a>

const encodedString = 'aHR0cHM6Ly93d3cua2twaWcuY24v';
const decodedString = atob(encodedString.replace('-', '+').replace('_', '/'));
const linkElement = document.getElementById('redirectLink');
linkElement.addEventListener('click', () => {
window.location.href = decodedString;
});

base64加解密:https://tool.kkpig.cn/base64/

0

评论 (0)

取消