set SWISSSURFER_USERAGENT e.g. to "Mozilla/5.0 (%Platform%; %Security%; %Subplatform%; %Locale%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Safari/%WebKitVersion%"; closes #88

This commit is contained in:
Marc Wäckerlin
2011-06-29 06:52:18 +00:00
parent 313b75fbf0
commit 6d16b9e672
7 changed files with 166 additions and 159 deletions

View File

@@ -9,6 +9,7 @@
#define __WEBPAGE_HXX__
#include <QtWebKit/QWebPage>
#include <QtCore/QProcessEnvironment>
class Browser;
@@ -16,7 +17,11 @@ class WebPage: public QWebPage {
public:
WebPage(Browser* b, QObject *parent = 0): QWebPage(parent), _browser(b) {}
protected:
QWebPage* createWindow(WebWindowType type);
virtual QWebPage* createWindow(WebWindowType type);
virtual QString userAgentForUrl(const QUrl& url) const {
return QProcessEnvironment::systemEnvironment()
.value("SWISSSURFER_USERAGENT", QWebPage::userAgentForUrl(url));
}
private:
Browser* _browser;
};