title: Javascript to append iframe to all external URLs
body: <p>javascript noob trying to figure something out. I saw a script located here:</p>
  
  <p><a href="https://stackoverflow.com/questions/1871371/using-jquery-to-open-all-external-links-in-a-new-window">Using jQuery to open all external links in a new window</a></p>
  
  <p>in which urls on a page are checked to see if they match the current page url. If not, this particular script would open them in a new window. I would like to use the same test on urls but if they are external I would like ?iframe to be appended to each url, a la fancybox syntax. My noob script is:</p>
  
  <pre><code>$(document).ready(function() {
      $('a[@href^="http://"]').filter(function() {
          return this.hostname &amp;&amp; this.hostname !== location.hostname;
      }).append('?iframe')
  });
  </code></pre>
  
  <p>which I believe is incorrect. Any assistance? Thanks</p>