twebbrowser

How do I save the contents of TWebBrowser, including user-entered form values?

坚强是说给别人听的谎言 提交于 2020-01-13 09:57:07
问题 is it possible to save entire document loaded in Webbrowser (in Delphi) as a ordinary HTML file with new values (I mean values entered by user in html's forms this document)? I need this for reading this HTML document with all values next time when application will be used. 回答1: Sure this is possible! Small demo App, make a new vcl forms application, drop a TWebBrowser , a TButton and a TMemo on your form and use this code (don't forget to bind OnCreate for the Form and OnClick for the Button

WebBrowser and OLECMDID_SELECTALL

筅森魡賤 提交于 2020-01-04 04:15:09
问题 When I open the Google web page using: WebBrowser1.Navigate('http://www.google.com.au/advanced_search?hl=en'); it opens with the cursor in the edit box. So when I use: WebBrowser1.ExecWB(OLECMDID_SELECTALL,OLECMDEXECOPT_PROMPTUSER,vaIn, vaOut); it only copies where the cursor is. Not the whole web page, which is what I want to copy. my code is: procedure Pause() begin //code to pause until page loads. end; procedure TForm2.Button22Click(Sender: TObject); var s:String; vaIn, vaOut: OleVariant;

Modify requestHeaders in “custom” browser in delphi

左心房为你撑大大i 提交于 2020-01-03 17:35:56
问题 I have a browser integrated in my deplhi application (IE). I need to call a certain web app and I need to append a new variable in the header for all the requests that come from my application's browser, like jquery adds to the xhrobj the HTTP_X_REQUESTED_WITH parameter. Any idea on how can I do that? code samples would be great. I am usin TWebBrowser . 回答1: You can modify the headers with the OnBeforeNavigate2 event: procedure TForm1.WebBrowser1BeforeNavigate2(Sender: TObject; const pDisp:

Can the TWebBrowser be used in a thread in Delphi without Application.ProcessMessages?

纵然是瞬间 提交于 2020-01-01 14:44:50
问题 I am trying to create screen captures of web pages in a Delphi server application (XE2) using TWebBrowser. The screen captures are initiated via web service calls to my server, so to preserve scalability, I would like to service the requests without relying on critical sections or Application.ProcessMessages to do the web page rendering. Can this be done with TWebBrowser? 回答1: I've done this already in a number of objects, and sadly enough the TWebBrowser object ties very much into it's

Getting Cookie from TWebBrowser

左心房为你撑大大i 提交于 2019-12-31 05:09:58
问题 Trying to download a file using indy,(post to asp save the excel response) but running into errors, using wireshark the request is missing cookies. Trying to grab the cookie out of a Twebbrowser window and save it. procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject); var document: IHTMLDocument2; cookies:tstringlist; begin cookies:=tstringlist.Create; document := WebBrowser1.Document as IHTMLDocument2; cookies.Add(document.cookie); //do stuff with them end; returns nothing, whats

TWebBrowser - Detecting the tag under caret

本秂侑毒 提交于 2019-12-24 10:25:39
问题 I want to detect on which HTML tag (more exactly hyperlink) is the caret. procedure THTMLEdit.ShowTag; var CursorPos: TPoint; HtmlElement: IHTMLElement; iHTMLDoc: IHtmlDocument2; begin if Supports(wbBrowser.Document, IHtmlDocument2, iHTMLDoc) then begin if GetcaretPos(CursorPos) then begin CursorPos := wbBrowser.screentoclient(CursorPos); HtmlElement := iHTMLDoc.ElementFromPoint(CursorPos.X, CursorPos.Y); // I NEED KEYBOARD CARET HERE, NOT MOUSE CURSOR if HtmlElement <> NIL then label1

TPanel does not AutoSize when containing a TWebBrowser

限于喜欢 提交于 2019-12-23 15:33:37
问题 I've found a another regression between Delphi 5 and Delphi XE6. I have a TPanel that is set to AutoSize itself to its contents (Panel is green): When the TPanel contains any other control, e.g. a TListView , the panel will auto-size itself to the size of the contained listview: But when the contained control is a TWebBrowser (or the replacement TEmbeddedWB), the panel will not auto-size: Must be TWebBrowser's fault There must be some VCL plumbing needed for auto-sizing that the TWebBrowser

TWebBrowser modal print dialog?

自古美人都是妖i 提交于 2019-12-23 02:17:08
问题 I've found many ways to make the TWebBrowser show a modeless print dialog box, but how do I make it show a modal one? I would like to print an html page, that's why I need the modal dialog. I'd really appreciate your ideas on this one. Thanks! 回答1: I cannot think of a reason why there would be lots of ways to show a modeless dialog. Why would you want to continue interacting with the web browser while a modeless print dialog is displayed? If you want to initiate the print by program, but need

TWebBrowser modal print dialog?

人走茶凉 提交于 2019-12-23 02:17:03
问题 I've found many ways to make the TWebBrowser show a modeless print dialog box, but how do I make it show a modal one? I would like to print an html page, that's why I need the modal dialog. I'd really appreciate your ideas on this one. Thanks! 回答1: I cannot think of a reason why there would be lots of ways to show a modeless dialog. Why would you want to continue interacting with the web browser while a modeless print dialog is displayed? If you want to initiate the print by program, but need

read content in webbrowser input field

老子叫甜甜 提交于 2019-12-23 01:40:37
问题 Something I have been trying to do and still can't get done. Reading the information typed in a website input field and being able to copy that. Is there a way I can read the ty 回答1: try these articles about using TWebBrowser and delphi to read data from a web page. How to read and write form elements TWebBrowser OleObject and Document data 回答2: Javascript document.getElementById('input-field-id').value returns the contents of an input box. What are you trying to do? 来源: https://stackoverflow