Why triggered the redirect?

<!DOCTYPE html>
<html>
the <head>
<title></title>
</head>
the <body>
 <a href="/tipo-website/" style="font-size:64pt">link</a>
</body>
<script type="text/javascript">
<code lang="javascript">
 document.addEventListener('click', function(e){
if(event.target.nodeName=='A'){
window.location.href=event.target.href+window.location.search;
 return !0
}
});
</code>
</script>
</html>

should be redirected to /tipo-site/ and get the parameters that I specified in the address bar, but it works somehow without them
April 4th 20 at 00:38
1 answer
April 4th 20 at 00:40
Solution
let timerId = setTimeout(function tick() {
 timerId = setTimeout(tick, 1000);
 var hrefs = document.getElementsByTagName('a');
[].forEach.call(hrefs,function(el){
 el.onclick = function (e) {
window.location.href=event.target.href+window.location.search;
 return false;
}
});
 }, 1000);

every second will just add the onclick to the new url

Find more questions by tags JavaScript