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.

Browser Behavior

dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Browser Behavior

Post by dilfich »

This didn't seem to happen before, I noticed by chance. With each new transition, something like a new initialization.
(it's also visible on the windows cursor, it reacts to the opening of links every time)

For example we alternate... MiniBrowser
  • data:text/html;charset=utf-8;base64,CjxodG1sPjxib2R5IGJnY29sb3I9IndoaXRlIj48aDI+Q0xSPC9oMj48L2JvZHk+PC9odG1sPg==
    https://www.google.com/
    https://ya.ru/
I checked in the official example, there is no such thing noticeable, everything is smooth as a normal browser.
cef_binary_100.0.24+g0783cf8+chromium-100.0.4896.127_windows32_client
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Browser Behavior

Post by dilfich »

Image

Here is an example, changed in MiniBrowser to follow links to Enter for similarity.
In the screenshot, I highlighted what was meant.
And the video shows that cefclient.exe does not have a similar phenomenon

https://drive.google.com/file/d/1aat5OWJZ2ND50dGriDXTSC0ClDBqtKGC/view

And if you open something in several instances of the browser, it's just a disaster, just because of one cursor, it's not possible to work on a PC. :?
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Browser Behavior

Post by salvadordf »

MiniBrowser now uses TChromium.OnCursorChange to update the cursor.

Please, download CEF4Delphi again from GitHub and check if that problem is now fixed.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Browser Behavior

Post by dilfich »

I forgot to answer, no, nothing has changed.

A simple test

Code: Select all

procedure TMiniBrowserFrm.Button1Click(Sender: TObject);
begin
  TThread.CreateAnonymousThread(
    procedure
    var
      T: Integer;
    begin
     for T:= 0 to 99 do begin
      Chromium1.LoadURL('about:blank');
      Sleep(500);
      Chromium1.LoadURL('https://www.google.com');
      Sleep(1000);
     end;
    end).Start;
end;
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Browser Behavior

Post by salvadordf »

Hi,

Every sleep call freezes the main application thread and this should be avoided because the application can't handle new windows messages.

Use asynchronous methods and events instead. Don't run CPU intensive code in CEF events and also avoid calling sleep in any CEF event to improve performance and responsiveness.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Browser Behavior

Post by dilfich »

Apparently you misunderstood me.
Please watch the minute-long video where the mini browser and the official client are shown.

https://workupload.com/file/FNV8CaxTjt7

Pay attention to the cursor when I click on the link or go back.

This is really a problem. If the application is automated and follows the links at this time it is not possible to work at the computer because the cursor is constantly flashing and it does not matter whether it is fast to make a transition from one link or fast.

And the video shows that this manifests itself even with normal navigation, unlike the official client.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Browser Behavior

Post by salvadordf »

I've searched for any code that sets the cursor to crAppStart, CT_PROGRESS or IDC_APPSTARTING and I couldn't find anything on CEF or CEF4Delphi.

I also did a quick search in Delphi's source code and I couldn't find anything relevant.

I tested the official CEF sample application with some of the command line switches that CEF4Delphi uses and I could reproduce this issue with cefclient.

Try using this and you will see the crAppStart cursor when you click some links:

Code: Select all

cefclient.exe --no-sandbox
Delphi and Lazarus can't use Chromium's sandbox and the only way to avoid this issue is to use a browser in OSR mode where you have absolute control of the cursor.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Browser Behavior

Post by dilfich »

This is the point that in OSR the same thing is so the cursor flashes not only over the browser program but everywhere.
For example, you can use a timer and click on two different links in turn.
At the same time, this is not observed in the SingleProcess mode, but it would be better on the contrary ((
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Browser Behavior

Post by dilfich »

I noticed that this behavior is similar if you work with a Google site, but there is no such thing with another :shock:

good
Chromium.LoadURL('https://www.briskbard.com/');
bad
Chromium.LoadURL('https://www.google.com/');

So the problem is in the content, but how to avoid this? :?
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Browser Behavior

Post by salvadordf »

dilfich wrote: Mon May 08, 2023 6:47 am So the problem is in the content, but how to avoid this? :?
This is caused by some internal code change in Chromium. I don't know why this is happening.
Post Reply