diff --git a/src/phantom.cpp b/src/phantom.cpp index d284f4b5..3e664614 100644 --- a/src/phantom.cpp +++ b/src/phantom.cpp @@ -160,19 +160,6 @@ Phantom::Phantom(QObject *parent) m_page->settings()->setAttribute(QWebSettings::AutoLoadImages, autoLoadImages); m_page->settings()->setAttribute(QWebSettings::PluginsEnabled, pluginsEnabled); - m_page->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); - m_page->settings()->setOfflineStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); - - m_page->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); - -#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) - m_page->settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, true); -#endif - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - m_page->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); - m_page->settings()->setLocalStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); -#endif #endif m_page->mainFrame()->addToJavaScriptWindowObject("phantom", this); diff --git a/src/webpage.cpp b/src/webpage.cpp index 3e827faf..1c3e3d41 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -98,6 +99,20 @@ WebPage::WebPage(QObject *parent) m_mainFrame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); m_mainFrame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); + m_webPage->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); + m_webPage->settings()->setOfflineStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); + + m_webPage->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + m_webPage->settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, true); +#endif + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + m_webPage->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); + m_webPage->settings()->setLocalStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); +#endif + // Ensure we have at least document.body. m_mainFrame->setHtml("");