title: Django - Javascript - Disable cache on image refresh
body: <p>I use, in my template, the following javascript to refresh an image:</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  $(document).ready(function() {
      var $img = $('#imageactual');
      setInterval(function() {
          $.get('{{ MEDIA_URL }}{{ data_to_modify.thumbnail.name }}?cachebuster='+Math.floor(Math.random()*100 +1), function(data) {
              var $loader = $(document.createElement('img'));
              $loader.one('load', function() {
                  $img.attr('src', $loader.attr('src'));
              });
              $loader.attr('src', data);
              if($loader.complete) {
                  $loader.trigger('load');
              }
          });
      }, 2000);
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>And I display the image with the following html code:</p>
  
  <pre><code>&lt;img  id="imageactual" src="{{ MEDIA_URL }}{{ data_to_modify.thumbnail.name }}" /&gt;
  </code></pre>
  
  <p>In my view I added </p>
  
  <pre><code>@never_cache
  @cache_control(max_age=0, no_cache=True, no_store=True, must_revalidate=True)
  </code></pre>
  
  <p>and </p>
  
  <pre><code>    response = render(request, 'mainsite/modify.html', locals(), context_instance=RequestContext(request))   
      response['Cache-Control'] = 'no-store, no-cache, must-revalidate proxy-revalidate'
      response['Expires'] = 'Thu, 01 Jan 1970 00:00:00 GMT'
      response['Pragma'] = 'no-cache'
      return response
  </code></pre>
  
  <p>But the image is still caching in the browser (Chrome: Version 35.0.1916.153 m)... Do you have any idea how to avoid this?</p>
  
  <p><strong><em>EDIT 1:</em></strong></p>
  
  <pre><code>**Header:**
  
  Remote Address:127.0.0.1:80
  Request URL:http://127.0.0.1/medias/thumbs/odbgelguelteeglndjssastj.jpg
  Request Method:GET
  Status Code:200 OK (from cache)
  </code></pre>