[PyQt] QWebPage don't execute javascript anymore

Vincent Vande Vyvre vincent.vande.vyvre at telenet.be
Fri May 26 10:27:42 BST 2017


Le 25/05/17 à 23:46, Florian Bruhin a écrit :
> Hi,
>
> On Thu, May 25, 2017 at 02:39:31PM +0200, Vincent Vande Vyvre wrote:
>> Is it a change known into QWebPage with javascript content ?
> No - but subclassing QWebPage in your example and implementing
> javaScriptConsoleMessage shows:
>
>      Cross-origin image load denied by Cross-Origin Resource Sharing policy.
>
> Doing this in your code makes it work:
>
>      self.settings().setAttribute(QWebSettings.LocalContentCanAccessRemoteUrls, True)
>
>> Note: I can't change my code for QtWebEngineView.QWebEnginePage because
>> QtWebEngineView is not provided for Debian/Ubuntu.
> It is for Debian Stretch and Ubuntu 17.04:
>
> https://packages.debian.org/stretch/libqt5webengine5
> https://packages.ubuntu.com/zesty/libqt5webengine5
>
> There are also unofficial packages for the QtWebKit successor:
>
> https://github.com/annulen/webkit/wiki
> http://repo.paretje.be/unstable/
>
> Florian
>
Thanks Florian, that's works with this setting.

Now, I presume, the best thing to do is move my code from QtWebKit* to 
QWebEngine*.


Vincent




More information about the PyQt mailing list