Hello.
I need to save all localStorage changes to my own database. is it any way to observe all changes of the localStorage? (Something line OnCanSaveCookie for cookies)
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.
Observe localStorage changes
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Observe localStorage changes
Hi,
Perhaps you can do that with the DevTools methods and events but I haven't tried it.
Try the "Storage Domain" and "DOMStorage Domain" methods and events :
https://chromedevtools.github.io/devtoo ... t/Storage/
https://chromedevtools.github.io/devtoo ... OMStorage/
Perhaps you can do that with the DevTools methods and events but I haven't tried it.
Try the "Storage Domain" and "DOMStorage Domain" methods and events :
https://chromedevtools.github.io/devtoo ... t/Storage/
https://chromedevtools.github.io/devtoo ... OMStorage/
Re: Observe localStorage changes
How can I use DevTools methods and events in CEF4Delphi? I found it in DevTools but I don't understand how can I use this events in my code.
Re: Observe localStorage changes
Look in the sources for methods for clearing the cache \ storage.xpert13 wrote: Tue Sep 08, 2020 4:37 pm How can I use DevTools methods and events in CEF4Delphi? I found it in DevTools but I don't understand how can I use this events in my code.
Code: Select all
Chromium1.ExecuteDevToolsMethod(0, 'Network.clearBrowserCache', nil);
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Observe localStorage changes
As dilfich said, there are some code examples in TChromiumCore and also in some demos like DOMVisitor or MiniBrowser.
In this case I suppose you would have to do this for the "Storage Domain" :
In this case I suppose you would have to do this for the "Storage Domain" :
- Call TChromium.ExecuteDevToolsMethod with a "Storage.trackCacheStorageForOrigin" method parameter and the origin you wish to track.
https://chromedevtools.github.io/devtoo ... eForOrigin - Implement TChromium.OnDevToolsEvent to handle the "Storage.cacheStorageContentUpdated" event.
- Call TChromium.ExecuteDevToolsMethod with a "DOMStorage.enable" parameter.
- Implement TChromium.OnDevToolsEvent to handle all the "DOMStorage Domain" events : DOMStorage.domStorageItemAdded, DOMStorage.domStorageItemRemoved, DOMStorage.domStorageItemsCleared, DOMStorage.domStorageItemUpdated.
Re: Observe localStorage changes
Thank you guys! It's what I was looking for.