Hi all,

I want to add a canonical to a page that is gerated with my CMS.

For instance, I want to add: <link rel="canonical" href="testURL" /> to my page.

I figured that this possibele using Javascript and tried the following:

<script type="text/javascript">
var head = document.getElementsByTagName('head')[0];
var canonical = document.createElement('link');

Question: Why doesn't this work?

I am not experienced in programming in Javascript, but I have some basic skills.