Hello. I have an application of type QMAinWindow in it QWebKit.QWebView. Everything works, but for example, the site mail.ru does not work correctly. And immeno, when you click on the news there is no transition. The same notice when clicking on some advertisements. LocalStorage is up and running. What is the reason for this and how to make WebKit work normally?

Here is the code

import sys from PyQt4 import QtGui, QtCore, QtWebKit if __name__ == "__main__": app = QtGui.QApplication(sys.argv) window = QtWebKit.QWebView() window.settings().globalSettings().setAttribute(QtWebKit.QWebSettings.LocalStorageEnabled, True) window.settings().setLocalStoragePath("/home/user/Browser/Storage/") window.load(QtCore.QUrl("https://mail.ru")) window.show() sys.exit(app.exec_()) 
  • one
    WebKit has, for example, a number of bugs. It is possible that it does not work correctly ... - Vladimir Martyanov
  • Please provide the code. For example, a lot depends on how you handle the opening of the page in a new window. - Nicolas Chabanovsky
  • The simplest code added ... It works incorrectly as written above ... - VolArt

1 answer 1

It is necessary to add the processing of the click on the links and link the click signal to the download of the clicked link:

 ... window = QtWebKit.QWebView() window.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks) window.linkClicked.connect(window.load) ... 
  • Thank. Those. already means qt4 itself to influence the movement of WebKita. I thought somewhere the setting in the very WebKite ... - VolArt
  • I did not find another :) - gil9red