How to enable the offline storage feature?
I compile qt4.7.1 and demos/browser,and use the browser to test the html5 offline cache,but it doesn't work.
I add some statements in BrowserApplication::loadSettings() function like this:
Code:
defaultSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled,true);
defaultSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled,true);
defaultSettings->setAttribute(QWebSettings::LocalStorageEnabled,true);
defaultSettings->setOfflineStoragePath("/root/offline");
defaultSettings->setOfflineWebApplicationCachePath("/root/offline");
defaultSettings->setLocalStoragePath("/root/offline");
defaultSettings->setOfflineStorageDefaultQuota(5*1024*1024);
defaultSettings->setOfflineWebApplicationCacheQuota(5*1024*1024);
I've no idea about the difference between OfflineStorage and OfflineWebApplicationCache.So,I add them both.
Any ideas?Thanks.
Re: How to enable the offline storage feature?
Can you write to that path as a non root user?
Re: How to enable the offline storage feature?
Not work either.Is anything missing?
I compile qt for x11 with configure -debug.
Re: How to enable the offline storage feature?
Can you please respond in full sentences and with context?
Otherwise it will be very hard for people to understand you.
What didn't work either?
Why do you think anything is missing?
What does compiling Qt with the -debug flag have to do with this?
I don't know where this path comes from, but most likely, you can not write to it from a normal user account.
Re: How to enable the offline storage feature?
Quote:
Originally Posted by
tbscope
Can you please respond in full sentences and with context?
Otherwise it will be very hard for people to understand you.
What didn't work either?
Why do you think anything is missing?
What does compiling Qt with the -debug flag have to do with this?
I don't know where this path comes from, but most likely, you can not write to it from a normal user account.
Sorry for that.
I login as root,so have the privillege to write the path /root/offline,and after I set this
in BrowserApplication::loadSettings()
Code:
defaultSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled,true); defaultSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled,true);
defaultSettings->setAttribute(QWebSettings::LocalStorageEnabled,true);
defaultSettings->setOfflineStoragePath("/home/offline");
defaultSettings->setOfflineWebApplicationCachePath("/home/offline");
defaultSettings->setLocalStoragePath("/home/offline");
defaultSettings->setOfflineStorageDefaultQuota(5*1024*1024);
defaultSettings->setOfflineWebApplicationCacheQuota(5*1024*1024);
There is a db file named ApplicationCache.db in the dir /home/offline.that may mean offlineWebApplicationCache works,am I right?
I setup apache tomcat6.0,and use the chrome to test html5 cache,it's ok.According to the QT Reference Document QWebSettings Class,it should also support.
I want to know whether what I've done is right?Thank you.
Re: How to enable the offline storage feature?
It seems demobrowser can not use web application cache when it restarts.
Re: How to enable the offline storage feature?
I've got the offline storage working after I made:
webView->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
webView->settings()->enablePersistentStorage(QDir::homePath());
Other settings (setOfflineStorageDefaultQuota e.t.c.) seem to be optional.
(one may want to change homePath to something better :))
Re: How to enable the offline storage feature?
Hi,
I am trying to enable application cache(offline webstorage) by just with the following api settings()->enablePersistentStorage("C:\\dd\\");
With this api,I should see LocalStorage and ApplicationStorage folders in C:\dd .But I am seeing only LocalStorage folder in the C:\dd.
I have even tried with the below code
settings()->enablePersistentStorage("C:\\dd\\");
settings()->setOfflineWebApplicationCachePath("C:\\dd\\AppCac he");
I dont see any AppCache folder in C:\dd directory
Can anyone help me what has gone wrong ...
Re: How to enable the offline storage feature?
Maybe it gets created on the first use.