Link to home
Start Free TrialLog in
Avatar of AngryC
AngryC

asked on

How can I send some HTML code to TWebBrowser control?

Hello,

I have a TWebBrowser control on my form and I want to send some HTML code to it.

How can I do that?

Thanks.
Avatar of Amir Azhdari
Amir Azhdari
Flag of United States of America image

Hi,
First Save the HTML Code the a html File and try to load it by
WebBrowser1.Navigate('thefilename.html');
Avatar of AngryC
AngryC

ASKER

Thanks but I think there's a direct way to do the thing without saving.
ASKER CERTIFIED SOLUTION
Avatar of Cesario Lababidi
Cesario Lababidi
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AngryC

ASKER

Thanks guys.

Cesario,

Can you tell me what's the benefits of the following:

while WebBrowser.ReadyState < READYSTATE_INTERACTIVE do
   Application.ProcessMessages;

?
Cesario,

If WebBrowser.ReadyState is less than READYSTATE_INTERACTIVE means that the browser might not initialized and it might not have loaded all of its properties. In this state ususally any interaction with the browser should be avoided.

The above code helps you to make sure that the browser is initialized and has loaded all of its properties and it is ready to process your request (e.g. requesting a web page etc.)
Atul_parmar,

thanx for your comment :-)
Avatar of AngryC

ASKER

Ok, just one question more. Should I use Cesario's code or the following:

http://www.cryer.co.uk/brian/delphi/twebbrowser/put_HTML.htm