我正在使用web浏览器,在不更改任何QWebEngineSettings的情况下,github无法加载必要的javascript。
访问github 时的QWebEngines javascript输出
The Content-Security-Policy directive 'worker-src' is implemented behind a flag which is currently disabled.
Uncaught TypeError: this.toggleAttribute is not a function
Uncaught TypeError: this.toggleAttribute is not a function
Uncaught (in promise) ReferenceError: AbortController is not defined
...
等等,我试着设置
settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true);
settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, true);
并确保它们被启用,但没有取得任何成功。有人知道我必须更改哪个安全策略才能使github正常工作吗?
从Qt 5.9.9升级到5.15.0解决了这个问题。