The following code is written for loading the HTML string (as Stream) into TWebBrowser:
procedure TfrmTestDialog.LoadDocumentFromStream(const Stream: TStream);
var
PersistStreamInit: IPersistStreamInit;
StreamAdapter: IStream;
begin
if not Assigned(dWebBrowser.Document) then Exit;
// Get IPersistStreamInit interface on document object
if dWebBrowser.Document.QueryInterface(IPersistStreamInit,
PersistStreamInit) = S_OK then
begin
// Clear document
if PersistStreamInit.InitNew = S_OK then
begin
// Get IStream interface on stream
StreamAdapter:= TStreamAdapter.Create(Stream);
// Load data from Stream into WebBrowser
PersistStreamInit.Load(StreamAdapter);
end;
end;
end;
But i need to achieve this in TChromium browser.
Anyone please help me on this...
You can convert the stream to a string using TStringStream :
That function is available here : http://embarcadero.newsgroups.archived.at/public.delphi.vcl.components.using/200907/0907292775.html
Then call TChromium.LoadString to load the resulting string as you can see in the MiniBrowser demo : https://github.com/salvadordf/CEF4Delphi/blob/7798f97872e4ca6f5246e3fdda04feeb990f88c7/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L725