I am developing an application that uses the ‘QWebview’ to display the websites on the internet.
My problem is, the website which I am trying to load has a authentication popup window (HTTP BASIC AUTH) so you can enter a username and password, after the authorization, when I try to open a link in new window or tab it is keep asking me the same popup instad of loading the page directly. Here is my Webview subclass.
WebView
::WebView(QWidget *parent
) : QWebView
(parent
) { page()->deleteLater();
QWebPage *newWeb = new QWebPage();
NetworkAccessManager *network = new NetworkAccessManager();
setPage(newWeb);
page()->setForwardUnsupportedContent(true);
page()->setNetworkAccessManager(network);
this->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
this->settings()->setAttribute(QWebSettings::JavaEnabled, true);
this->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
this->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
this->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
this->settings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
this->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
}
WebView *WebView::createWindow(QWebPage::WebWindowType type)
{
WebView *view = new WebView;
return view;
}
WebView::WebView(QWidget *parent) : QWebView(parent) {
page()->deleteLater();
QWebPage *newWeb = new QWebPage();
NetworkAccessManager *network = new NetworkAccessManager();
setPage(newWeb);
setRenderHints(QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing | QPainter::Antialiasing);
page()->setForwardUnsupportedContent(true);
page()->setNetworkAccessManager(network);
this->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
this->settings()->setAttribute(QWebSettings::JavaEnabled, true);
this->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
this->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
this->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
this->settings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
this->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
}
WebView *WebView::createWindow(QWebPage::WebWindowType type)
{
WebView *view = new WebView;
return view;
}
To copy to clipboard, switch view to plain text mode
If anyone can help me on this, that would be great.
Thanks.
Bookmarks