TWebBrowserControl

Hi,

How is this control used?

Thanks,

Ken

Technically this is an IFRAME inside your web page that you can point to any  URL via WebBrowserControl.URL, so it is quite similar to using a TWebBrowser on a VCL form.

Ok, thanks.

Hi Bruno,


I tried to display a pdf-file in the TWebBrowserControl.
WB_O1.Navigate('D:\O1.pdf');
or
WB_O1.URL:='D:\O1.pdf';

do not display the pdf. 

Can you give me support how I can realized it? Or is there another component more able to do that in a WebCore application?

Many thanks
Patrick

Browser secure environment prevents to load from local resources (it would be a security breach if it would be possible.)
Any other resource should work though:


Example:
procedure TForm3.WebButton1Click(Sender: TObject);
begin
end;

You are right, your example works.


How would you realize it, to display a local pdf-file with a TWebCore Application?

Many thanks
Patrick

You would need to use a TWebFilePicker and select the local PDF file via a TWebFilePicker


Example:

procedure TForm3.WebFilePicker1Change(Sender: TObject);
var
  fo: TJSHTMLFile;
  s: string;
begin
  fo := WebFilePicker1.Files.Items[0].FileObject;
  asm
    s = URL.createObjectURL(fo);
  end;
  WebBrowserControl1.URL := s;
end;

Hi Bruno,


many thanks for the example - it works fine and caused that I just started the web-development it is very helpful for me!

Is there also a possibility to set an url to the WebBrowserControl1 that its remember by the next start. 

So I say to the application to display a file like described by you before. After that whereever in the company the application is opened or refreshed the same file is shown?

I tried to save the url in a textfile, but it was not possible for me to handle with textfiles in the webCore-Environment. May be there is a better solution.

Many thanks
Patrick

You could store the last used URL in localstorage (see WebLib.Storage unit) and then get the value from local storage and use it for the webbrowser when the web client application starts again.