twebbrowser

Which is the best way to load a string (HTML code) in TWebBrowser?

北战南征 提交于 2019-12-04 17:49:26
I have a string var 'HTMLCode' that contains HTML code. I want to load this code into the browser. This is Embarcadero's code: procedure THTMLEdit.EditText(CONST HTMLCode: string); {VAR Doc: IHTMLDocument2; TempFile: string; } begin TempFile := GetTempFile('.html'); StringToFile(TempFile, HTMLCode); wbBrowser.Navigate(TempFile); Doc := GetDocument; if Doc <> NIL then Doc.Body.SetAttribute('contentEditable', 'true', 0); //crash here when I load complex html files DeleteFile(TempFile); end; It has some problems so I replaced it with this one: procedure THTMLEdit.EditText(CONST HTMLCode: string);

Delphi TChromium / DCEF3 - Constant Access Violations

a 夏天 提交于 2019-12-04 17:15:44
I'm trying to use DCEF3 TChromium as a replacement for TWebbrowser component. I downloaded the packages and installed it on my IDE (Delphi 2007). I'm testing the demo on demos\guiclient and when i try to open certain web pages, i get tons of Access Violation exceptions and my app crashes. If i'm inside Delphi, i get this exception before Delphi itself crashes : 'Assertion failure : 'item.src' in \win32scr\DBKIMPL.CPP' at line 2691' One example of a page that has this problem is www.whatsmyuseragent.com One example of a page that opens correctly is www.google.com After a lot of testing i found

Delphi TWebBrowser Memory Leak

爷,独闯天下 提交于 2019-12-04 16:54:36
My application uses a TWebBrowser that loads a webpage. The problem is, after closing the form containing the TWebBrowser, the memory used is not freed. If I open and close the form, the memory just keeps on increasing. Saw some post regarding calling SetProcessWorkingSetSize() or CoFreeUnusedLibrariesEx() to solve this issue, but I'm not sure if any of these are the correct solution. Any idea how to free the memory used by TWebBrowser? QC#106829 describes one possible cause of memory leaks with TWebBrowser. Accessing Document (and any other properties that are implemented via TOleControl

How can I add an extra http header using IHTTPNegotiate?

陌路散爱 提交于 2019-12-04 11:26:51
How can I add an extra header to the request using IHTTPNegotiate? I added the interface but functions BeginningTransaction & OnResponse never get called. TNameSpaceHandler = class(TComObject, IInternetProtocol, IHttpNegotiate) ... function BeginningTransaction(szURL, szHeaders: LPCWSTR; dwReserved: DWORD; out szAdditionalHeaders: LPWSTR): HResult; stdcall; function OnResponse(dwResponseCode: DWORD; szResponseHeaders, szRequestHeaders: LPCWSTR; out szAdditionalRequestHeaders: LPWSTR): HResult; stdcall; ... end; I'm silently assuming you're intercepting traffic by both implementing

Chrome/ Firefox Alternative to TWebBrowser Control

江枫思渺然 提交于 2019-12-04 10:36:52
问题 I have a Delphi app that shows a group of webpages in a TWebBrowser control. Its a kiosk type app so a user touches a button on the side and it shows a particular webpage in a tab. I am having some problems with certain sites and getting IE javscript errors. I would like to know if there is a way I can embed a chrome or firefox browser in a tab or on a form from Delphi? This question seems to answer the issue I had with getting javascript errors. 回答1: I should have googled first. Found this

Creating TWebBrowser in Runtime with Delphi

人走茶凉 提交于 2019-12-04 08:49:47
I have a TWebBrowser object which is created in runtime and used in background, that is, not visible. The problem is that events like OnDocumentComplete dont work or are not triggered in Delphi2009. Any advice? procedure TfrmMain.FormCreate(Sender: TObject); begin FWebBrowser:= TWebBrowser.Create(Self); FWebBrowser.RegisterAsBrowser:= True; FWebBrowser.OnDocumentComplete:= WhenDocIsCompleted; end; procedure TfrmMain.WhenDocIsCompleted(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant); begin ShowMessage('Doc is completed!'); end; There is any difference important between Navigate

CSS and TWebbrowser delphi

荒凉一梦 提交于 2019-12-03 22:21:42
问题 I was wondering if it was possible to manipulate the CSS of websites. For example color in the input fields? I had a look at several questions, but its not clear to me if it is possble at all. For Example in Google Chrome, Whenever a field is selected it shows a golden line around the outsite. Is it possible to do this and other things in delphi, with any website. Writing CSS code that gets applied to the website opend in Twebbrowser? Just for personal viewing only Thx Can I change the color

TWebbrowser in Windows 10: Microsoft Edge (formerly Spartan) / Internet Explorer legacy issues

两盒软妹~` 提交于 2019-12-03 20:54:57
问题 We know Internet Explorer will be discontinued in Windows 10, being replaced by the new Microsoft Edge (formerly codenamed "Project Spartan"). There are millions of apps using TWebbrowser, a component that uses the Internet Explorer API. Does anybody have information about how those applications will work in future versions of Windows? How can we be prepared to keep our applications working in future Windows versions? 回答1: According to IE Blog Internet Explorer 11 will remain fundamentally

How do I redirect the TWebBrowser control to a custom URL?

我与影子孤独终老i 提交于 2019-12-03 18:05:46
问题 Example: I navigate to http://www.stackoverflow.com with my web browser control there's a link to FAQ in the top bar, with target https://stackoverflow.com/faq I need to redirect e.g. to the http://math.stackexchange.com when I click the FAQ link 回答1: The easiest way, as kobik suggested is to use TWebBrowser.OnBeforeNavigate2 event. Here is the example. procedure TForm1.WebBrowser1BeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers:

Detecting external content with TEmbeddedWB or TWebBrowser

依然范特西╮ 提交于 2019-12-03 16:37:17
I am trying to block anything external loaded by TEmbeddedWB or TWebBrowser (or TCppWebBrowser). I would like to block anything that is loaded from Internet including images, javascript, external CSS, external [embed] or [object] or [applet] or [frame] or [iframe], executing JavaScript that can load external content etc. This problem consists of 2 parts: putting web browser into "restrict all" (except basic HTML without images) and detecting if such content exists if external content is not present ok, if it is, showing a "download bar" which after click puts web browser into "download all"