LocalStorage Saves

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

LocalStorage Saves

Postby TheoR74 » Wed Apr 16, 2014 1:11 pm

I am using Microsoft Visual Studio 2012, Cer Version 3.1846.1637.

When trying, either from the sample local storage page, or from my own version, to save to localstorage via jacascript (localStorage.SetItem and localStorage.GetItem). It appears to work OK. But when I quit the application and go back in, the data is not there.

Is there something that needs to be set to have it use local storage?

Thanks,
Theo
TheoR74
Techie
 
Posts: 15
Joined: Wed Apr 09, 2014 11:22 am

Re: LocalStorage Saves

Postby magreenblatt » Wed Apr 16, 2014 1:14 pm

You need to set CefSettings.cache_path.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: LocalStorage Saves

Postby TheoR74 » Wed Apr 16, 2014 1:22 pm

Forgive me for sounding very dumb here, but.... What should I set it to?
TheoR74
Techie
 
Posts: 15
Joined: Wed Apr 09, 2014 11:22 am

Re: LocalStorage Saves

Postby Czarek » Wed Apr 16, 2014 1:25 pm

TheoR74 wrote:Forgive me for sounding very dumb here, but.... What should I set it to?

http://magpcss.org/ceforum/apidocs3/projects/(default)/_cef_settings_t.html#cache_path
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: LocalStorage Saves

Postby magreenblatt » Wed Apr 16, 2014 1:26 pm

TheoR74 wrote:Forgive me for sounding very dumb here, but.... What should I set it to?

The full path where you want the cache data to persist on disk. For example:
Code: Select all
CefString(&settings.cache_path).FromASCII("c:\\temp\\cache");
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: LocalStorage Saves

Postby TheoR74 » Wed Apr 16, 2014 1:31 pm

magreenblatt wrote:
TheoR74 wrote:Forgive me for sounding very dumb here, but.... What should I set it to?

The full path where you want the cache data to persist on disk. For example:
Code: Select all
CefString(&settings.cache_path).FromASCII("c:\\temp\\cache");

Can I set it to be the same directory where the executable is at?
TheoR74
Techie
 
Posts: 15
Joined: Wed Apr 09, 2014 11:22 am

Re: LocalStorage Saves

Postby TheoR74 » Wed Apr 16, 2014 1:36 pm

Actually, I see now if I don't specify the path, just the folder name, that goes where I want.

This works great. Thanks for you help!!!
TheoR74
Techie
 
Posts: 15
Joined: Wed Apr 09, 2014 11:22 am

Re: LocalStorage Saves

Postby magreenblatt » Wed Apr 16, 2014 1:40 pm

TheoR74 wrote:Actually, I see now if I don't specify the path, just the folder name, that goes where I want.

You shouldn't rely on this. It will likely be relative to the active working directory and may not always be the path you want.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: LocalStorage Saves

Postby TheoR74 » Fri Apr 18, 2014 11:58 am

magreenblatt wrote:
TheoR74 wrote:Actually, I see now if I don't specify the path, just the folder name, that goes where I want.

You shouldn't rely on this. It will likely be relative to the active working directory and may not always be the path you want.


Is there a way to tell it to use the application path?
TheoR74
Techie
 
Posts: 15
Joined: Wed Apr 09, 2014 11:22 am

Re: LocalStorage Saves

Postby emerick » Fri Apr 25, 2014 10:26 am

TheoR74 wrote:Is there a way to tell it to use the application path?


You can use GetModuleFileName to figure out your application path, but storing data there will get pretty messy and you'll most likely run into Windows security restrictions. It's better to store this kind of stuff in your application's AppData folder.
emerick
Expert
 
Posts: 154
Joined: Sun Feb 21, 2010 7:57 pm
Location: Belmont, MA


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 93 guests