Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Load page source code
Load page source code
Can i load the source code of the page to execute javascript in it ???
- salvadordf
- Posts: 4580
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Load page source code
Hi,
Yes, you can do all that. See the code behind the upper-right button in the MiniBrowser demo to see how to load files with a FILE URI or a DATA URI.
That demo also shows how to execute JavaScript code with TChromium.ExecuteJavaScript
Chromium has some security limitations with the FILE URIs that can be avoided by registering a custom scheme. See the SchemeRegistrationBrowser demo and register HTTP in case you have that problem.
Yes, you can do all that. See the code behind the upper-right button in the MiniBrowser demo to see how to load files with a FILE URI or a DATA URI.
That demo also shows how to execute JavaScript code with TChromium.ExecuteJavaScript
Chromium has some security limitations with the FILE URIs that can be avoided by registering a custom scheme. See the SchemeRegistrationBrowser demo and register HTTP in case you have that problem.
Re: Load page source code
My main problem is that you need to execute javascript in a multi-threaded application, but dcef4 asynchronous can not tell how to do it?
- salvadordf
- Posts: 4580
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Load page source code
There's only one way to execute JavaScript code that I mentioned before.
If the application has multiple threads you can call TChromium.ExecuteJavaScript from any thread.
Search "ExecuteJavaScript" in all the demos and you will find many examples.
If the application has multiple threads you can call TChromium.ExecuteJavaScript from any thread.
Search "ExecuteJavaScript" in all the demos and you will find many examples.
Re: Load page source code
i know how to execute javascript i don't know how to sync with chrome, i need to
1. go to the site
2. execute javascript
3. get source code page
4. destroy/Terminated Chromium
And do it all multithreaded
Chromium is asynchronous so I don't know how to wait fulfillment
1. go to the site
2. execute javascript
3. get source code page
4. destroy/Terminated Chromium
And do it all multithreaded
Chromium is asynchronous so I don't know how to wait fulfillment
- salvadordf
- Posts: 4580
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Load page source code
Try using some custom "state" field to keep track of the current step the app is executing. For example, state could have this type :
Code: Select all
TMyCustomState = (csIdle, csLoading, csExecutingJS, csGettingCode, csDestroying);
Re: Load page source code
Can you post the source code for this?
- salvadordf
- Posts: 4580
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Load page source code
You'll find most of the code you need to implement those functions with CEF4Delphi in the demos but there are no demo with exactly the same features you ask for.
You will have to implement that state controlled program for yourself.
You will have to implement that state controlled program for yourself.