title: Script loads gif in internet explorer, chrome, but not firefox
body: <p>To properly display a "loading" image in my application, I made the following script:</p>
  
  <pre><code>var spinnerVisible = false;
  
  function ShowProgress() {
      if (!spinnerVisible) {
          $('div#layer').fadeIn("fast");
          $('div#spinner').fadeIn("fast");
          spinnerVisible = true;
  
          var spinner = $('#spinner');
  
          spinner.html('&lt;span&gt;Loading, please wait...&lt;/span&gt;&lt;img src="/Content/ajax-loader.gif" width="250" height="250"/&gt;').css('background', '#fff').show();
      }
  }
  </code></pre>
  
  <p>The <code>ajax-loader.gif</code> image is loading fine in internet explorer and Chrome, but it does not load in Firefox?</p>
  
  <p><em>EDIT</em></p>
  
  <p>I have obtained the url of the image, which goes like this:</p>
  
  <pre><code>http://localhost:63779/Content/ajax-loader.gif
  </code></pre>
  
  <p>If I copy-paste the url in firefox, the gif is loading, but now when the function is called...?</p>
  
  <p><em>EDIT 2</em></p>
  
  <p>I don't know if it is related, but I have found this:</p>
  
  <p><a href="https://stackoverflow.com/questions/1388893/jquery-html-in-firefox-uses-innerhtml-ignores-dom-changes">jQuery html() in Firefox (uses .innerHTML) ignores DOM changes</a>&lt;</p>
  
  <p>Maybe it is related to my problem?</p>
  
  <p><em>EDIT 3</em></p>
  
  <p>Ok, so something strange happened, which I don't really like, but here goes:</p>
  
  <p>Firs I have tried this:</p>
  
  <pre><code>    var element = document.getElementById('spinner');
  
      element.setAttribute("'&lt;span&gt;Loading, please wait...&lt;/span&gt;&lt;img src=\"/Content/ajax-loader.gif\" width=\"250\" height=\"250\" background=\"#fff\"/&gt;')", element.innerHTML);
  
      alert(document.getElementById("spinner").innerHTML);
  </code></pre>
  
  <p>As I tested in firefox it gave me an error saying that there were illegal characters in my string. So I put the <code>element.setAttribute</code> line in comments and I got the proper alert...
  And the gif showed!</p>
  
  <p>But that's not all: sometimes it plays, sometimes it does not. I'm slightly confused right now, I don't understand why.</p>