-
-
Save 3con/6e28f0be84fe699169fbfa15faac6885 to your computer and use it in GitHub Desktop.
Set Canonical URL via Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment