title: How to automatically add target="_blank" to external links only?
body: <p>I'm building a custom, industry-specific cms (using django).  In the backend, webmasters can specify either an internal link, e.g. "/page1" or an external link to use for various navigation elements throughout the website (all use <code>&lt;a&gt;</code> when rendered) .  The problem is that I would like internal links to open in the current tab, but external links should use <code>target="_blank"</code> to open a new tab or window.  </p>
  
  <p>How can I process the html to accomplish this?  </p>
  
  <p>I'd prefer a server-side solution, but am not aware of any clean way to pre-process rendered templates in django. So, I assume the most straightforward way to do this is probably a javascript/jquery solution: a script that runs when each page loads, which adds the target="_blank" attribute to all external links but not internal links.  But I'm not sure how to do this, either. </p>