title: Replace existing canonical tag with javascript or jquery
body: <p>I'm wanting to create a widget for Adobe Muse that replaces the canonical tags that Muse automatically generates. </p>
  
  <p>I know that this will not work with most bots because they don't run any scripts when crawling pages, but I have read that Google's bot does run scripts when it crawls.</p>
  
  <p>I found many questions on how to replace the href from a links but I couldn't seem to find any questions on replacing the href URL of a canonical tag. I'm almost positive this is where I start... I just don't know how to finish it:</p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function() {
           $('link[rel=canonical]').attr('href' 'NEW_LINK');
      }
  &lt;/script&gt;
  </code></pre>