title: Hitting browser "back" button shows JSON rather than HTML (using Rails & d3.js)
body: <p>I'm generating a chart in Rails using a d3.js JSON callback like this:</p>
  
  <p>View</p>
  
  <pre><code>d3.json(document.URL, function(data){ 
      // generate chart
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>def index
      respond_to do |format|
          format.html do
              # return the HTML
          end
          format.json do
              # return the JSON
          end
      end
  end
  </code></pre>
  
  <p>All works fine.  However when a user leaves this chart, and then navigates back to it using the "back" button on their brower they are presented with the JSON rather than the HTML.</p>
  
  <p>Can you suggest how I might fix this?</p>