-
-
Save blueprintmrk/28c89f18d7e587f936af98c70636db4e to your computer and use it in GitHub Desktop.
Set Canonical URL via Javascript
This file contains hidden or 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