title: POST 403 Forbidden for Chrome extension with Django on the backend
body: <p>I've never developed Chrome extensions before and currently working on the Chrome extension (with link submission functionality) for my Django-powered app. When I try to submit a link using the extension I get the following error: </p>
  
  <pre><code>'POST http://127.0.0.1:8000/add_link_from_extension 403 (FORBIDDEN)'
  </code></pre>
  
  <p>This can be solved by passing csrfmiddlewaretoken in the postdata JSON, however, obviously I can't do </p>
  
  <pre><code>&lt;script&gt;var csrfmiddlewaretoken = "{{ csrf_token }}"&lt;/script&gt;
  </code></pre>
  
  <p>in the html file from Chrome extension. How would you pass csrf_token from Django to Chrome extension's JavaScript? Alternatively, is there any other way around this issue? Here's the relevant portion of  the JS code from the Chrome extension:</p>
  
  <pre><code>postdata = {
          "url":url.value
          //"csrfmiddlewaretoken": csrfmiddlewaretoken 
      };
  $.post('http://' + "127.0.0.1:8000" + '/add_link_from_extension', postdata, success);
  </code></pre>