title: Using Tidhttp with Twebbrowser
body: <p>I am using the tidhttp control to speed up the loading of a webpage in a Twebbrowser. Navigating to the url is slow so thats why I don't use it(<code>WebBrowser1.Navigate('some_url_here')</code>). Here is how i do it:</p>
  
  <pre><code>procedure TForm1.Button2Click(Sender: TObject);
    procedure LoadHtmlIntoBrowser(var WB: TweBbrowser; const HTMLString: string);
    var
      v: OleVariant;
      HTMLDocument: IHTMLDocument2;
    begin
      WB.Navigate('about:blank');
      while WB.ReadyState &lt; READYSTATE_INTERACTIVE do
        forms.Application.ProcessMessages;
  
      if Assigned(WB.Document) then
      begin
        HTMLDocument := WB.Document as IHTMLDocument2;
        v := VarArrayCreate([0, 0], varVariant);
        v[0] := HTMLString;
        HTMLDocument.Write(PSafeArray(TVarData(v).VArray));
        HTMLDocument.Close;
      end;
      forms.Application.ProcessMessages;
    end;
  
  var
    str:string;
  begin
    str:=idhttp1.Get('http://localhost/myhome.html');
    LoadHtmlIntoBrowser(WebBrowser1,str);
  end;
  </code></pre>
  
  <p>I use the <code>idHTTP</code> to get the html content into a string then write that string directly to Webbrowser. I have a local webserver setup(XAMPP). The problem I having is that after the html content has been written to the browser and I click a link that is displayed, it goes no where i.e. it shows a mostly blank page with "twopage.html" at the top. When I right click and "view source" i get <code>"&lt;html&gt;twopage.html&lt;/html&gt;"</code> which is strange and not the actual html of the page.</p>
  
  <p>The "myhome.html" file contains </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
    &lt;body&gt;&lt;h1&gt;My home&lt;/h1&gt;&lt;a href="twopage.html"&gt;&lt;/a&gt;&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><code>The other webpage, "twopage.html" contains</code> </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
    &lt;body&gt;&lt;h1&gt;Another Webpage&lt;/h1&gt;&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>