Page 1 of 1

How to start CEF4Delphi

Posted: Sat Feb 15, 2020 12:07 am
by bobpang
Hello, there are a few information about cef4delphi on the Internet.
I really can't understand those demos. Come here for help.
Who can tell me the function of those components:
TChromium, TCEFWindowParent, TChromiumWindow, TBufferPanel,TCEFWorkScheduler, TCEFServerComponent, TCEFLinkedWindowParent,TCEFUrlRequestClientComponent
Now, I need to write a Chengxu, read the div element of HTML, and then operate on JS. I saw the demo domvisitor, but for a novice, it's really too difficult, and my English is not good. Who can provide me with a basic demo, just to realize its function, and where else can I get some learning materials?
Thank you very much.

Re: How to start CEF4Delphi

Posted: Sat Feb 15, 2020 8:30 am
by salvadordf
Hi,

Please, read this document :
https://www.briskbard.com/index.php?lang=en&pageid=cef

Take the code in the SimpleBrowser2 demo as a template for your application and read its code comments.

You can execute JavaScript code with a simple TChromium.ExecuteJavaScript call. In fact, it's the recommended way to search for HTML elements and manipulate the DOM.

Re: How to start CEF4Delphi

Posted: Sun Feb 16, 2020 12:29 pm
by bobpang
Salvadordf thank you very much for your reply.
Now I have successfully executed a JS code using this function. And use the chromium1jsdialog event to get the return value successfully.
But in demo DOMVisitor,What is the starting sequence?
1、CreateGlobalCEFApp
2、GlobalCEFApp_OnProcessMessageReceived
3、FormCreate
4、FormShow
and when you click the menu,will psotmessage and call GlobalCEFApp_OnProcessMessageReceived to received form process.
so what is this DOMVisitor_OnDocAvailable ? i can't understand comments for it.


By the way, I don't know if the forum or learning materials can add Chinese. I can do translation for free.

Re: How to start CEF4Delphi

Posted: Sun Feb 16, 2020 12:40 pm
by bobpang
And now ,I have a new problem about cookies.
Just like we open Chrome browser, every web page will have a different tab. If you are visiting different addresses, it is OK to store cookies at the same file. Now I want to use CEF to open the same web page in this program. How can I store cookies and they are not confused? For example, tab1 stores the information of user a, and TAB2 stores the information of user B.
Then how to read their cookies separately at startup?
If my description is not correct, I believe you must have the right idea, please let me get some advice from you sir.
Thanks a lot.

Re: How to start CEF4Delphi

Posted: Sun Feb 16, 2020 4:43 pm
by salvadordf
bobpang wrote: Sun Feb 16, 2020 12:29 pm Salvadordf thank you very much for your reply.
Now I have successfully executed a JS code using this function. And use the chromium1jsdialog event to get the return value successfully.
But in demo DOMVisitor,What is the starting sequence?
1、CreateGlobalCEFApp
2、GlobalCEFApp_OnProcessMessageReceived
3、FormCreate
4、FormShow
and when you click the menu,will psotmessage and call GlobalCEFApp_OnProcessMessageReceived to received form process.
so what is this DOMVisitor_OnDocAvailable ? i can't understand comments for it.
The recommended way to manipulate the DOM is using JavaScript because CEF has a very limited set of functions to do that.

Read the code comments in the JSExtension demo to know all the details about process messages in CEF.
https://github.com/salvadordf/CEF4Delph ... n.pas#L131
bobpang wrote: Sun Feb 16, 2020 12:29 pm By the way, I don't know if the forum or learning materials can add Chinese. I can do translation for free.
Thank you very much for your offer! :D

I'll be adding links to personal blogs form the main information page in the coming days :
https://www.briskbard.com/index.php?lang=en&pageid=cef

If you write an article in your blog about CEF4Delphi just let me know and I'll add a link to your site.

Re: How to start CEF4Delphi

Posted: Sun Feb 16, 2020 4:48 pm
by salvadordf
bobpang wrote: Sun Feb 16, 2020 12:40 pm And now ,I have a new problem about cookies.
Just like we open Chrome browser, every web page will have a different tab. If you are visiting different addresses, it is OK to store cookies at the same file. Now I want to use CEF to open the same web page in this program. How can I store cookies and they are not confused? For example, tab1 stores the information of user a, and TAB2 stores the information of user B.
Then how to read their cookies separately at startup?
If my description is not correct, I believe you must have the right idea, please let me get some advice from you sir.
Thanks a lot.
Build the MDIBrowser demo and run it.
Add a check mark in the "Create a new request context for new browsers" box and click on the button to create a new browser.
Each new browser will have independent cookies and cache.

All you need to create an independent browser is to create a new "request context" before the TChromium.CreateBrowser call.
https://github.com/salvadordf/CEF4Delph ... m.pas#L203

Re: How to start CEF4Delphi

Posted: Sun Feb 16, 2020 5:43 pm
by salvadordf
I just added some links to a few articles and blogs in other languages with CEF4Delphi information :
https://www.briskbard.com/index.php?lan ... f#moreinfo

Re: How to start CEF4Delphi

Posted: Fri Feb 21, 2020 7:53 am
by bobpang
thank u