Results 1 to 6 of 6

Thread: Using cache with QNetworkAccessManager in QWebEngine

  1. #1
    Join Date
    Aug 2016
    Posts
    6
    Qt products
    Qt5
    Platforms
    Windows

    Default Using cache with QNetworkAccessManager in QWebEngine

    So. I've found this post http://www.qtcentre.org/threads/4626...kAccessManager
    And looks like it doesn't work this way in QWebEngine. When I'm trying to load my programm in QWebKit, it shows cached page. But when I'm using QWebEngine, it shows regular chromium's "No internet connection" page. How should I change code in order for it to work in QWebEngine?
    Thanks for your help!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using cache with QNetworkAccessManager in QWebEngine

    QWebEngine doesn't use QNetworkAccessManager, the network handling is part of the web process which is the provided by the Chromium engine code.

    It looks like the QWebEngineProfile has cache settings though.
    Accessible through the view's QWebEnginePage.

    Cheers,
    _

  3. #3
    Join Date
    Aug 2016
    Posts
    6
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Using cache with QNetworkAccessManager in QWebEngine

    Still can't understand how to remake it, so now it would cache and load cached page...


    Added after 6 minutes:


    All I need to know is - how to save and load cache in QWebEngine?
    Last edited by d1psy; 18th August 2016 at 11:26.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using cache with QNetworkAccessManager in QWebEngine

    So if you set a file based cache type (which should be the default according to documentation), does QWebEngine not save anything?
    Maybe try setting the cache path and see if that directory gets any files?

    Maybe you need to set the http cache size.

    Cheers,
    _

  5. #5
    Join Date
    Aug 2016
    Posts
    6
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Using cache with QNetworkAccessManager in QWebEngine

    The path is set. Size is also set. But it just shows "No internet connection". But in QWebKit it works the way it's supposed to. It would be much easier if there was some kind of caching example in QWebEngine


    Added after 4 minutes:


    I've just created a simple "Hello!" html page and tried to open it offline through my program. It still showed me "No internet connection", instead of showing simple "Hello!"
    Last edited by d1psy; 18th August 2016 at 12:17.

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using cache with QNetworkAccessManager in QWebEngine

    So the cache is only used when it could get the content from the actual server.

    Maybe you need to set a request interceptor that, when no connection is available, redirects to the local file.

    Cheers,
    _

Similar Threads

  1. Get Html element value with QWebEngine
    By danalex07 in forum Newbie
    Replies: 10
    Last Post: 5th February 2016, 03:18
  2. QWebEngine MP4 5.5
    By RolandHughes in forum Qt Programming
    Replies: 0
    Last Post: 14th December 2015, 23:04
  3. QWebEngine HTML5 video tag & MP4/H.264 videos
    By jarruza in forum Qt Programming
    Replies: 0
    Last Post: 15th October 2015, 03:43
  4. Using cache with QNetworkAccessManager
    By remy_david in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2011, 14:28
  5. Replies: 1
    Last Post: 18th December 2009, 11:20

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.