Localstorage lost

axa
Posts: 13
Joined: Tue May 07, 2019 9:25 pm

Localstorage lost

Post by axa » Tue Jan 14, 2020 12:10 pm

Hi,

I am wondering if there is any settings to preserve (ex: initialization CefCache := 'e:\temp\cef'; for DCEF3) localstorage.
After I restart the application all data from local storage is lost, however the data is preserved between multiple instances
until I close the application

Thank you in advance

PS: I use FMX

User avatar
salvadordf
Posts: 2596
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Localstorage lost

Post by salvadordf » Tue Jan 14, 2020 12:23 pm

Hi,

Set the GlobalCEFApp.cache property to a writable directory to preserve the local storage when you close your application.

I would also recommend that you create all your browsers inside one application if you need them to share the same cache data. If you open several instances of your application and all of them have the same GlobalCEFApp.cache value you may have problems.

axa
Posts: 13
Joined: Tue May 07, 2019 9:25 pm

Re: Localstorage lost

Post by axa » Tue Jan 14, 2020 2:12 pm

Thanks,

GlobalCEFApp.cache was the way.

Also I have another question.
When I use FMX, if the window is restored from the task bar, the window is blank and looks like in the picture.
If I resize the blank from any corner even 1px the browser content is restored.

Image


how to restore also the browser window/component ?

User avatar
salvadordf
Posts: 2596
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Localstorage lost

Post by salvadordf » Tue Jan 14, 2020 3:12 pm

Please, download the latest CEF4Delphi version from GitHub.

That issue was fixed recently and now the SimpleFMXBrowser demo works correctly when you restore it from the task bar.

If you still see that bug please make sure you uninstalled the previous CEF4Delphi version before installing the new one.
Delete all the old BPL and DCU files before installing the new CEF4Delphi version.

axa
Posts: 13
Joined: Tue May 07, 2019 9:25 pm

Re: Localstorage lost

Post by axa » Tue Jan 14, 2020 9:21 pm

Dear Salvador,

I have updated CEF4Delphi including CEF 79.1.10 but the problem persist with Simple FMX Browser and my application.

I have made the following steps:
1. Uninstall CEF4 from IDE and removed the folder (CEF4Delphi-master) - this location include also ALL DCU FILES
2. Remove from
C:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl\CEF4Delphi_FMX.bpl
C:\Users\Public\Documents\Embarcadero\Studio\20.0\DCP\ CEF4Delphi_FMX.bpi, CEF4Delphi_FMX.bpi, CEF4Delphi_FMX.lib
C:\Users\Public\Documents\Embarcadero\Studio\20.0\hpp\Win32 - all headers (148 items)
3. Create a new directory CEF4Delphi-master and installed CEF4
4. Build and run SimpleFMXBrowser.

TEST 1 (begin test after the app starts) - OK
1. Click "-" button to minimize the window.
2. Click on task bar icon to restore - works correctly

However if you will minimize the app by clicking on the "task bar icon"

TEST 2 (begin test after the app starts) - FAILED on the second cycle
1. Click task bar icon to minimize ( not "-" button from the app window )
2. Click task bar icon to restore

TEST 3 (begin test after the app starts)
1. Click task bar icon to minimize ( not "-" button from the app window )
2. Click task bar icon to restore (restore OK)
3. Click task bar icon to minimize
4. Click task bar icon to restore (restore FAILED)
5. Click "-" button to minimize the window (FAILED window)
6. Click task bar icon to restore (restore OK)


Thank you for your prompt reply

User avatar
salvadordf
Posts: 2596
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Localstorage lost

Post by salvadordf » Wed Jan 15, 2020 5:17 pm

Thanks for reporting this issue!

I just uploaded a new CEF4Delphi version that includes a fix for that bug in the FMX demos in normal mode : SimpleFMXBrowser and FMXToolBoxBrowser.

I had to replace the uFMXApplicationService unit with a custom WndProc procedure to handle the Windows messages correctly.

All the changes are here :
https://github.com/salvadordf/CEF4Delphi/commit/91a845e42f9c9f0f1d7fe7437cf29c4a47e01707

Let me know if I missed something. ;)

axa
Posts: 13
Joined: Tue May 07, 2019 9:25 pm

Re: Localstorage lost

Post by axa » Wed Jan 15, 2020 11:05 pm

:D Now it's working fine! I didn't find any other problem with minimize/restore

Thanks again

axa
Posts: 13
Joined: Tue May 07, 2019 9:25 pm

Re: Localstorage lost

Post by axa » Fri Feb 07, 2020 12:12 am

Hello,

Unfortunately today I have found that this bug (minimize/restore) is still present
if in the browser window you have a java script alert/prompt window open.

To reproduce the error please follow these steps:
1. Run the SimpleFMXBrowser and go to
2. https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_alert
3. click on the "Try it" button from the right (the alert box will show-up).
4. with the "Hello! I am an alert box!!" open (DO NOT CLOSE THE ALERT) try to minimize/restore
few times the browser window from the taskbar


Thank you.

User avatar
salvadordf
Posts: 2596
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Localstorage lost

Post by salvadordf » Fri Feb 07, 2020 1:20 pm

Thanks for reporting this!

I'll take a look as soon as I can.

User avatar
salvadordf
Posts: 2596
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Localstorage lost

Post by salvadordf » Sat Feb 08, 2020 12:04 pm

Please, download CEF4Delphi again.

The SimpleFMXBrowser and ToolboxBrowser demos should work fine when you restore them.

Post Reply