I don't know why but when the first request is executed the GUI freezes (W7x64, QT5.3, MinGW)
I tried disable the proxy config but without results.
first-xhr-slow.zip
#include "mainwindow.h"
MainWindow::MainWindow() {
this
->setUrl
(QUrl("qrc:/index.html"));
this
->setMaximumSize
(QSize(200,
200));
// No proxy
QNetworkProxyFactory::setUseSystemConfiguration(false);
this
->page
()->networkAccessManager
()->setProxy
(QNetworkProxy::NoProxy);
// Debug
this->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
QWebInspector *inspector = new QWebInspector();
inspector->setPage(this->page());
inspector->setVisible(true);
}
#include "mainwindow.h"
MainWindow::MainWindow() {
this->setUrl(QUrl("qrc:/index.html"));
this->setMaximumSize(QSize(200, 200));
// No proxy
QNetworkProxyFactory::setUseSystemConfiguration(false);
this->page()->networkAccessManager()->setProxy(QNetworkProxy::NoProxy);
// Debug
this->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
QWebInspector *inspector = new QWebInspector();
inspector->setPage(this->page());
inspector->setVisible(true);
}
To copy to clipboard, switch view to plain text mode
<html>
<body>
<div id="counter"></div>
<button id="request">request</button>
<script>
var counter = document.getElementById('counter'),
index = 0;
setInterval(function() {
counter.innerText = index++;
}, 100);
document.getElementById('request').onclick = function() {
var r = new XMLHttpRequest();
r.open('get', 'http://google.com');
r.send();
};
</script>
</body>
</html>
<html>
<body>
<div id="counter"></div>
<button id="request">request</button>
<script>
var counter = document.getElementById('counter'),
index = 0;
setInterval(function() {
counter.innerText = index++;
}, 100);
document.getElementById('request').onclick = function() {
var r = new XMLHttpRequest();
r.open('get', 'http://google.com');
r.send();
};
</script>
</body>
</html>
To copy to clipboard, switch view to plain text mode
Bookmarks