Most sources of documentation state that one can declare a webpage a duplicate of another by applying this tag on the duplicate page:

```
<link rel="canonical" href="(absolute URL to original page)">

```

I could generate the above tag via the script below:

```
<script>
var l=document.createElement('Link');
l.rel='canonical';l.href='(absolute URL to original page)';
document.getElementsByTagName('head')[0].appendChild(l);
</script>

```

My question is, would google be able to process this javascript and believe I'm declaring the page as a duplicate page? or would I be forced to use the link tag in the header?

I ask because I'm trying to reduce the unnecessary bytes required to be processed before the actual user readable content begins.