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.

How to reset a hung page?

cples
Posts: 8
Joined: Thu Apr 20, 2023 3:14 pm

How to reset a hung page?

Post by cples »

How to reset a hung page?
Chromium1.Stopload;
Chromium1.Reload;
Chromium1.Loadurl ('http: // .....');
It does not react, nothing changes.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to reset a hung page?

Post by salvadordf »

Hi,

All those functions are asynchronous and the browser may not react as expected if you call one after another.

Try calling TChromiumCore.ReloadIgnoreCache.
cples
Posts: 8
Joined: Thu Apr 20, 2023 3:14 pm

Re: How to reset a hung page?

Post by cples »

I didn't call them all at once, but one at a time.
And the browser did not respond to any of them.
Will try Chromium1.ReloadIgnoreCache,
thank you
cples
Posts: 8
Joined: Thu Apr 20, 2023 3:14 pm

Re: How to reset a hung page?

Post by cples »

Chromium1.ReloadIgnoreCache;
Unfortunately, it didn't change anything.

Chromium1.ClearCache;
Chromium1.LoadURL(url);
it doesn't change anything either
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to reset a hung page?

Post by salvadordf »

Run the MiniBrowser demo and open the DevTools using the button with 3 lines in the top-right position.
Click on the "Network" tab and navigate to that URL.
Check if some resource is failing to load and also check the "Console" tab to see if there's some JavaScript error.

Some web pages detect the embedded browsers (CEF and WebView2) to prevent bots, scrappers, automation, etc. If that web page blocks embedded browsers then try the TinyBrowser2 demo which uses the "Chrome runtime" mode.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: How to reset a hung page?

Post by dilfich »

It is most likely necessary to wait for the previous page loading or interrupt it.
It's easier to click on a new link than to update it.

Especially when it comes to working through a proxy. In a CEF temple, it is not clear here if you want to update or download a new one, you need to interrupt the download of the previous session.
The timeout in the browser is unmanageable, you can only sort of interrupt it through CloseAllConnections.

I have also been interested in the same question for a long time.
For example, I wait 10 seconds for downloading from a proxy, change the proxy and upload it again, but it does not always work correctly, often the previous request is also displayed in the "ResourceLoadComplete", which sometimes makes it unclear what was downloaded successfully and what with an error
cples
Posts: 8
Joined: Thu Apr 20, 2023 3:14 pm

Re: How to reset a hung page?

Post by cples »

Used DevTools.
The page does not always hang, somewhere in 30% of cases.
When the page loads, according to the Windows Task Manager, the process can reach 1.6 GB of memory.
The main volume is a text table of 20 thousand rows. It is loaded by javascript commands.
I didn't notice anything strange about DevTools, the page just freezes at the stage when all the information has already been received and is already being output to the screen. Compared with in Firefox, Chrome, Internet Explorer - the situation is better there, there are freezes only in Internet Explorer. In Firefox, Chrome, everything goes fine.
CloseAllConnections does not work.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to reset a hung page?

Post by salvadordf »

Perhaps it's running out of memory. Try building the demo in 64 bits.

If your application targets 32 bits only then make sure you add this code line in the DPR file :

Code: Select all

{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
Add Windows to the uses list because IMAGE_FILE_LARGE_ADDRESS_AWARE is defined in that unit.
cples
Posts: 8
Joined: Thu Apr 20, 2023 3:14 pm

Re: How to reset a hung page?

Post by cples »

{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} already initially present
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to reset a hung page?

Post by salvadordf »

Add these code lines before the GlobalCEFApp.StartMainProcess call :

Code: Select all

  GlobalCEFApp.LogFile             := 'debug.log';
  GlobalCEFApp.LogSeverity         := LOGSEVERITY_VERBOSE;
Let the browser hung, close it and then check the debug.log file.
Perhaps it shows some error information.
Post Reply