Page 1 of 2

How to reset a hung page?

Posted: Thu Sep 14, 2023 8:47 am
by cples
How to reset a hung page?
Chromium1.Stopload;
Chromium1.Reload;
Chromium1.Loadurl ('http: // .....');
It does not react, nothing changes.

Re: How to reset a hung page?

Posted: Thu Sep 14, 2023 11:20 am
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.

Re: How to reset a hung page?

Posted: Thu Sep 14, 2023 11:57 am
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

Re: How to reset a hung page?

Posted: Thu Sep 14, 2023 2:06 pm
by cples
Chromium1.ReloadIgnoreCache;
Unfortunately, it didn't change anything.

Chromium1.ClearCache;
Chromium1.LoadURL(url);
it doesn't change anything either

Re: How to reset a hung page?

Posted: Fri Sep 15, 2023 9:18 am
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.

Re: How to reset a hung page?

Posted: Fri Sep 15, 2023 1:58 pm
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

Re: How to reset a hung page?

Posted: Sat Sep 16, 2023 10:31 am
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.

Re: How to reset a hung page?

Posted: Sat Sep 16, 2023 10:58 am
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.

Re: How to reset a hung page?

Posted: Sun Sep 17, 2023 8:16 am
by cples
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} already initially present

Re: How to reset a hung page?

Posted: Sun Sep 17, 2023 8:57 am
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.