diff --git a/src/phantom.cpp b/src/phantom.cpp index 2c7ea85b..950a0013 100644 --- a/src/phantom.cpp +++ b/src/phantom.cpp @@ -76,7 +76,7 @@ Phantom::Phantom(QObject *parent) return; } - m_page = new WebPage(this, &m_config); + m_page = new WebPage(this, &m_config, QUrl::fromLocalFile(m_config.scriptFile())); m_pages.append(m_page); if (m_config.scriptFile().isEmpty()) { diff --git a/src/webpage.cpp b/src/webpage.cpp index 39b09f40..7ea2426c 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -103,13 +103,13 @@ private: friend class WebPage; }; -WebPage::WebPage(QObject *parent, const Config *config) +WebPage::WebPage(QObject *parent, const Config *config, const QUrl &baseUrl) : QObject(parent) { setObjectName("WebPage"); m_webPage = new CustomPage(this); m_mainFrame = m_webPage->mainFrame(); - m_mainFrame->setHtml(BLANK_HTML); + m_mainFrame->setHtml(BLANK_HTML, baseUrl); connect(m_mainFrame, SIGNAL(javaScriptWindowObjectCleared()), SIGNAL(initialized())); connect(m_webPage, SIGNAL(loadStarted()), SIGNAL(loadStarted()), Qt::QueuedConnection); diff --git a/src/webpage.h b/src/webpage.h index 350b00d7..ad4dbcc2 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -53,7 +53,7 @@ class WebPage: public QObject Q_PROPERTY(QVariantMap scrollPosition READ scrollPosition WRITE setScrollPosition) public: - WebPage(QObject *parent, const Config *config); + WebPage(QObject *parent, const Config *config, const QUrl &baseUrl = QUrl()); QWebFrame *mainFrame();