[Interest] Qt WebEngine, MHTML and custom schemes

Allan Sandfeld Jensen kde at carewolf.com
Tue Dec 1 09:11:18 CET 2020


On Montag, 30. November 2020 15:00:10 CET Benjamin TERRIER wrote:
> Hi,
> 
> When accessing an MHTML file using a custom local scheme (either using
> 'qrc:/' or using 'QWebEngineUrlSchemeHandler') it triggers a download.
> 
> However, when using 'file:/' the MHTML file is displayed as a web page.
> 
> I am trying to have the MHTML displayed also when using a custom scheme.
> I have tried to play with
> https://doc.qt.io/qt-5/qwebengineurlscheme.html#Flag-enum but it did not
> work.
> 
> Does someone have an idea to make it work?
> 
Unfortunately it is pretty hard-coded, see  src/3rdparty/chromium/content/
browser/loader/download_utils_impl.cc.

We could make it somewhat programmable by implementing 
ContentBrowserClientQt::AllowRenderingMhtmlOverHttp() which despite its name 
is called for all non-file schemes.

The question is then, should it be a setting per scheme or per page, and are 
there other people needing such a feature? The fact it is called from both IO 
and UI threads makes it a little more work than usual to implement.

Best regards
'Allan




More information about the Interest mailing list