Giter VIP home page Giter VIP logo

Comments (5)

chenzhifeng0025 avatar chenzhifeng0025 commented on September 13, 2024

With the above code, it does create a separate cache directory, but it should remember the username and password. Am I doing something wrong? Is there anything that needs to be corrected?

It should be noted that you need to comment out this line of code: // GlobalCEFApp.cache := 'cache';

from cef4delphi.

salvadordf avatar salvadordf commented on September 13, 2024

Copy the code that creates the child browsers in the MDIBrowser demo and it should work the same.
Assigning a new request context allows you to create independent browsers that store the cache, cookies, etc in a different directory for that browser.

Please, for more questions use our forum :
https://www.briskbard.com/forum/

from cef4delphi.

chenzhifeng0025 avatar chenzhifeng0025 commented on September 13, 2024

The code above is from MDIBrowser and has been tested many times without success. Have you tested this feature in FMX? Isn't the code above the same as in MDIBrowser? Could you please check this FMX demo?


from cef4delphi.

chenzhifeng0025 avatar chenzhifeng0025 commented on September 13, 2024

I reviewed the code repeatedly, and the final code is as follows:

procedure TBrowserFrame.CreateBrowser;
var
  {$IFDEF MSWINDOWS}
  TempHandle: HWND;
  TempRect: System.Types.TRect;
  TempClientRect: TRectF;
  TempScale: single;
  {$ENDIF}
begin
  CreateFMXWindowParent;

  if not (FMXChromium1.Initialized) then
  begin
    {$IFDEF MSWINDOWS}
    TempHandle := FmxHandleToHWND(FMXWindowParent.Handle);
    TempClientRect := FMXWindowParent.ClientRect;
    TempScale := FMXChromium1.ScreenScale;
    TempRect.Left := round(TempClientRect.Left);
    TempRect.Top := round(TempClientRect.Top);
    TempRect.Right := round(TempClientRect.Right * TempScale);
    TempRect.Bottom := round(TempClientRect.Bottom * TempScale);

    FMXChromium1.DefaultUrl := FHomepage;
    var TempCache := GlobalCEFApp.RootCache + '\cache' + inttostr(1);
    var TempContext := TCefRequestContextRef.New(TempCache, '', '', False, True, False, FMXChromium1.ReqContextHandler);
    FMXChromium1.CreateBrowser(TempHandle, TempRect, '', TempContext);

//      FMXChromium1.CreateBrowser(TempHandle, TempRect);
    {$ENDIF}
  end;
end;

This code still doesn't work. I believe there might be a bug in your FMX version. Could you please test it personally?


This is the modified code attachment.

FMXTabbedBrowser.zip

from cef4delphi.

chenzhifeng0025 avatar chenzhifeng0025 commented on September 13, 2024

The issue with the non-persistent feature has been resolved. I used the following code:

var TempCache := 'D:\cache2';
var TempContext := TCefRequestContextRef.New(TempCache, '', '', False, False, False, FMXChromium1.ReqContextHandler);
FMXChromium1.CreateBrowser(TempHandle, TempRect, '', TempContext);

The problem was that GlobalCEFApp.RootCache was empty, so I needed to set an absolute path. However, a serious issue has now arisen: after setting the directory, the entire page becomes extremely sluggish—so much so that even entering a password is very slow, making it almost impossible to work. The video below demonstrates the entire process (the project works normally when the path is empty, with the rest of the code unchanged).


Attached is the recorded video file.

default.mp4

from cef4delphi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.