title: Indy TIdHTTPServer OnCommandGet javascript in html not executing
body: <p>I have a <code>TIdHTTPServer</code> that sends javascript code in an html file to the browser with tag <code>&lt;script language="javascript"&gt;</code> in the <code>&lt;head&gt;</code> tag. I don't have access to the html file so I cannot change it's content. I use <code>HTTPServerCommandGet</code> to send the contents of this file to the browser like this :</p>
  
  <pre><code>procedure TMainForm.HTTPServerCommandGet(AContext: TIdContext;
    ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
  var
    responseMemoryStream : TMemoryStream;
  begin
    responseMemoryStream := TMemoryStream.Create;
    try
      AResponseInfo.ContentType := 'text/html';
      AResponseInfo.ContentEncoding := 'UTF-8';
      AResponseInfo.CharSet := 'UTF-8';
      responseMemoryStream.LoadFromFile(ExtractFilePath(Application.ExeName) + 'index.html');
      AResponseInfo.ContentStream := TMemoryStream.Create;
      TMemoryStream(AResponseInfo.ContentStream).LoadFromStream(responseMemoryStream);
    finally
      responseMemoryStream.Free;
    end;
  end;
  </code></pre>
  
  <p>When I then make a <code>GET</code> command from an internet browser it sometimes loads the javascript, but sometimes it doesn't - when I use <strong>Firefox</strong> there are no problems, but when I use <strong>Chrome</strong> or <strong>IE</strong> the javascript never executes. Is there a way to force the execution of the javascript code somehow with the <code>AResponseInfo</code> variable or there is nothing I can do to fix this ? </p>
  
  <p>This is what part of the <code>index.html</code> looks like :</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;meta name="keywords" content="" /&gt;
      &lt;meta name="description" content="" /&gt;
      &lt;meta  charset=utf8 /&gt;
      &lt;title&gt;My title&lt;/title&gt;
      &lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
      &lt;script language="javascript"&gt;
          var map;
          var flag_for_map_massage = 0;
          var map_marker = 0;
          function initmap()
          {
              var html;
              var map_divtxt = "&lt;div id=\"map_canvas\" style=\"width:200px;height:150px;\" &gt;&lt;/div&gt;";
              document.getElementById("google_map").innerHTML = map_divtxt;
              var latlng = new google.maps.LatLng(100.12345, 200.12345);
  
              var options = {
                  zoom: 17,
                  center: latlng,
                  mapTypeId: google.maps.MapTypeId.ROADMAP
              };
              var map1 = new google.maps.Map(document.getElementById("map_canvas"), options);
  
              var html = "&lt;table&gt;" +
                      "&lt;tr&gt;&lt;td&gt;GMBH Address&lt;/td&gt; &lt;/tr&gt;";
  
              infowindow = new google.maps.InfoWindow({
                  content: html
              });
              var marker1 = new google.maps.Marker({
                  position: new google.maps.LatLng(100.12345, 200.12345),
                  map: map1
  
              });
              //     infowindow.open(map1, marker1);
              google.maps.event.addListener(marker1, "click", function() {
                  infowindow.open(map1, marker1);
              });
          }
  
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="initmap();"&gt;  
    &lt;div class="entry"&gt;
      &lt;div id="google_map"&gt;
      &lt;/div&gt;
    &lt;/div&gt; 
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>