Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2011

    Lightbulb Is is posible to use local resource and cache page in Webview


    I want to use QML Webview in my mobile application to display a online store. I need css and jquery javascript support. Since jquery and css are always the same for online store, only the html part changed. So I want to compile the jquery js files, css files and some unchanged image(loading.gif) into resource (.qrc). Is that possible? and how to use it in my html? It seams that it doesn't work like this <script type="text/javascript" src=":/htm/jquery-1.4.2.min.js"></script>.

    On the other hand, to reduce the traffic and speed up the loading process. I want to cache some page in a session and cache some image permanently. For example, I want to cache online store home page during the whole session, so that end user don't need load the page second time and the page can be displayed rapidly when user access the home; Then how to write the code to implement it.

  2. #2
    Super Contributor
    Join Date
    Mar 2009

    Re: Is is posible to use local resource and cache page in Webview

    As far as I know webkit doesn't support the Qt resource system, then it's not able to load JS files from Qt resource files. Neither QWebSettings is able to do that, indeed the QWebSettings::setUserStyleSheetUrl(const QUrl & location) [1] reference manual states that "The location must be either a path on the local filesystem, or a data URL with UTF-8 and Base64 encoded data".

    About the cache, webkit has a cache system that works for HTML5 (http://www.webkit.org/blog/427/webki...-i-the-basics/). If you are interested in that you could take a look at the QWebSettings page [1]. BTW I believe you want to use somethings a more generic approach using the QNetworkDiskCache

    NetworkDiskCache* diskCache = new QNetworkDiskCache();
    [1] http://doc.qt.nokia.com/latest/qwebs...rStyleSheetUrl

  3. #3
    Registered User
    Join Date
    Jul 2010

    Re: Is is posible to use local resource and cache page in Webview

    rather late reply,
    it's working in Qt/c++, so it should be the same way with QML, call the path to the local file at the src like this,


Similar Threads

  1. is it posible to remove the notification when sending sms
    By arnelpogs_wahaha in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2010-08-03, 12:00
  2. Is it possible to detect whether the phone is in use using J2ME?
    By sunil_bhambani123 in forum Mobile Java General
    Replies: 3
    Last Post: 2008-12-22, 06:14
  3. Replies: 0
    Last Post: 2003-06-30, 10:17
  4. Is posible to use "Bluetooth CF Card" in a PC(not laptop)?
    By enriquegil in forum Bluetooth Technology
    Replies: 1
    Last Post: 2002-12-19, 08:41

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts