> On Apr 8, 2019, at 12:46 PM, Andy <asmalo...@gmail.com> wrote:
> 
> Not sure if it's the same situation, but I just had a similar problem - SVGs 
> weren't showing up properly because I had the wrong MIME type.
> 
> I fixed it by using the QMimeDatabase like this:
> 
>       const auto  cMIMEType = QMimeDatabase().mimeTypeForData( data );
> 
>       inRequest->reply( cMIMEType.name().toLatin1(), buffer );
> 
> (where "data" is the contents of a file)
> 

Thanks! That's pretty much what I'm doing. Knowing it seems to be working for
someone is a very useful data point.

Cheers,
  Steve


> ---
> Andy Maloney  //  https://asmaloney.com
> twitter ~ @asmaloney
> 
> 
> 
> On Mon, Apr 8, 2019 at 7:40 AM Steve Atkins <st...@blighty.com> wrote:
> I'm using a custom URL scheme by registering the scheme with 
> QEbEngineUrlScheme::registerScheme() at app startup, creating a handler 
> ("Assets")  that inherits from QWebEngineUrlSchemeHandler, installing that 
> scheme handler in the QWebEngineProfile passed to the QWebPage.
> 
> Assets::requestStarted(QWebEngineUrlRequestJob *job) handles the request and 
> finishes by doing job->reply() with a content type of application/javascript 
> and an open QFile.
> 
> Everything works fine. The page loads, it loads scripts from the header from 
> URLs asset:whatever.js, the content is correct and the js runs fine.
> 
> Until I try and load the asset: scripts as ES6 modules. Then I get "Error: 
> Failed to load module script: The server responded with a non-JavaScript MIME 
> type of \"\". Strict MIME type checking is enforced for module scripts per 
> HTML spec. (asset:/ticket.js:0)".
> 
> It seems from that that job->reply() is not setting the content-type of the 
> response successfully. I've tried to confirm that, but the chrome inspector 
> shows no response headers, and fetch() errors out because the custom URL 
> scheme isn't supported.
> 
> Does this look familiar to anyone? And has anyone used custom schemes with 
> content-types successfully?
> 
> Cheers,
>  Steve
> 
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to