I'm setting a browser widget within another application, but some sites practically nothing works with interaction because the JS on the sites returns an error 'violates the following Content Security Policy directive'. Tried to configure using QWebEngineProfile but without result.
import os
import sys
import pystray
from ctypes import windll
from PyQt5 import QtCore
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.setWindowFlag(QtCore.Qt.Tool)
self.browser = QWebEngineView()
self.profile = QtWebEngineWidgets.QWebEngineProfile.defaultProfile()
self.webpage = QWebEnginePage(profile, self.browser)
self.browser.setPage(self.webpage)
self.show()
if __name__ == "__main__":
app = QApplication(sys.argv)
app.setQuitOnLastWindowClosed(False)
QApplication.setApplicationName('Web Widget')
window = MWindow()
app.exec_()