Qt WebView 是否支持包含异步 Ajax 的网页?

Does Qt WebView support webpage containing asynchronous Ajax?

我使用 Chrome 浏览器加载网页,它工作正常(当我更改某些 JSON 文件时,点的位置总是在变化)。但是当我使用 Qt WebView 时,当我更改 JSON 文件时它不能改变点的位置,即使重新加载方法也不起作用。

我使用 ECharts(一些图表 class 库)来更新点的位置。 update方法利用了ECharts支持异步加载的特性。我还使用 setTimeInterval 方法来确保网页每秒可以根据一些 JSON 文件获取点的新位置。

答案是肯定的,而且,这是使用外部资源(如Ajax)的唯一方法。 QWebView (if you are using a version of Qt prior to 5.4) and in the documentation of QWebEngineView(所有其他情况)的文档中说。

... whereas external objects are loaded asynchronously.

external objects 指的是诸如 JavaScript 程序或样式表 (CSS) 之类的东西。不过要小心 :

The HTML document is loaded immediately.