[Qtwebengine] Some questions about porting from QtWebkit

Jocelyn Turcotte jocelyn.turcotte at digia.com
Wed Sep 10 12:56:21 CEST 2014


Hello Adrian,

On Tue, Sep 09, 2014 at 03:58:22PM +0200, Adrian Batzill wrote:
> Hello,
> I'm currently trying to port my application from QtWebkit to 
> QtWebEngine. I've sorted out the basics, but there are some problems 
> that remain and that I can't seem to find a solution to. Therefore I 
> hope someone here can help me.
> 
> a) How can I change the user agent for QtWebengine (at runtime)? The old 
> "userAgentForUrl" method doesn't seem to work any more.

We're planning to have a setting to set the user agent, but for 1.0 it
will still be hard-coded in qtwebengine/src/core/content_client_qt.cpp

> b) QWebkit WebViews have been independent, which means, that when having 
> multiple WebViews in one application, they had no shared data (except 
> for the cache AFAIK). E.g. cookies were not shared. I do rely on this 
> behaviour and wonder if this is possible in QtWebEngine aswell (It was 
> even possible to set a different proxy for each WebView)?

It is not currently possible, but we're thinking about exposing browsing
contexts in a future release, which could address this kind of use case.

> c) How can I handle SSL errors when they occur?

You can currently override QWebEnginePage::certificateError and return
true if you want to accept the untrusted certificate.

> d) QWebkit was able to disable plugins (e.g. flash). Is something like 
> this possible in QtWebEngine?

NPAPI isn't supported by Chromium anymore, and we don't have support for
NaCL plugins yet. When we add support in the future, we should expose a
setting to disable them too.

> e) How can I provide a Javascript error console? QWebPage had a 
> "javaScriptConsoleMessage" method that could be used. But 
> QtWebEnginePage?

QWebEnginePage also has a javaScriptConsoleMessage, it should behave
similarly.

> f) How can I set a network proxy (Socks 5) in QtWebEngine?

Chromium currently reads proxy settings directly from the system. On
linux, setting the http_proxy environment variable should work.
We didn't expose a way to override those settings in the API yet.

> I think these are all remaining problems I have right now.
> 
> Thanks for the time,
> Adrian

Thank you for the feedback.
There are many features of the QtWebKit API that we don't support at the
moment, and some that we don't plan on supporting. On the Web side
features should have a much better support than with QtWebKit.

Regards,
Jocelyn



More information about the QtWebEngine mailing list