title: text/event-stream recognised as a download
body: <p>I'm trying to implement server push in my Flask project following <a href="http://peter-hoffmann.com/stackoverflow/12236019.html" rel="noreferrer">this tutorial</a>.</p>
  
  <p>I've set it all up with no errors, however when I go to the /stream page, Firefox recognizes it as a file and tries to download it. In Safari it just prints out the data sent. I tried adapting the code to a simpler implementation, where a thread just yields some data each second, however it produced the same results.</p>
  
  <p>My goal is for each time a python script reaches a point in a loop, it will update a progress bar on the web interface.</p>
  
  <p>Any help with this would be great. Thanks.</p>
  
  <p>Edit:</p>
  
  <p>app.py</p>
  
  <pre><code>from flask import Flask, render_template, request, Response
  
  app = Flask(__name__)
  
  def event_stream():
      event = "Hello!"
      yield 'data: %s\n\n' % event
  
  @app.route('/stream')
  def stream():
      return Response(event_stream(), mimetype="text/event-stream")
  
  if __name__ == "__main__":
      app.debug = True
      app.run(threaded=True)
  </code></pre>
  
  <p>index.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
      &lt;script type="text/javascript"&gt;
          var source = new EventSource('/stream');
          source.onmessage = function (event) {
               alert(event.data);
          };
      &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;p&gt;Stream page&lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>