title: JavaScript SSE not working with Firefox
body: <p>I have a javascript that fires an EventSource for the page "checkMessages.php".
  That page returns data only if there is something new entered in the database. </p>
  
  <p>The problem here lies with Mozilla Firefox, because it does not update the SSE content whenever there is any change in the database. I checked the same with Google Chrome, and everything works absolutely fine.</p>
  
  <p>Moreover, I checked an HTML5 SSE demo from <a href="http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_sse" rel="nofollow">http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_sse</a> in Firefox, and it works. What's wrong with this code then?</p>
  
  <p>index.php:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  if(typeof(EventSource)!="undefined")
  {  
    var source=new EventSource("checkMessages.php");
    source.onmessage=function(event)
    {
          $("#new_message").html("Inbox"+event.data);
    }
  }
  else
  { 
          $("#new_message").html("HTML5 not supported");
  }
  
  &lt;/script&gt;
  
  &lt;div id="new_message_container"&gt;
      &lt;span id="new_message" onclick="readInbox($userid)"&gt;
          Inbox
      &lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>checkMessages.php:</p>
  
  <pre><code>&lt;?php
  session_start();
  require_once 'myfunctions.php';
  header('Content-Type: text/event-stream');
  header('Cache-Control: no-cache');
  $userid=studentidOf($_SESSION['user']);
  $query="Select msgby from messages where msgfor='$userid'";
  $result=queryMysql($query);
  $k=mysql_num_rows($result);
  
  if($k&gt;0)
      echo "data:($k)";
  
  flush();
  ?&gt;
  </code></pre>