Why my canonical doesnt readed from googlebot or seo spider programm. I used this code
<script type="text/javascript">
var link = document.createElement('link');
link.setAttribute('rel', 'canonical');
link.setAttribute('href', location.protocol + '//' + location.host + location.pathname);
document.head.appendChild(link);
</script>
<link rel="canonical" href="example.com/tested/">