JQuery doesn't works when the page is loaded from resource
I need to load web page and jQuery both from Qt Resources. I looked at the Fancy Browser example but it shows a case of loading page from internet and loading jQuery from resources (which btw works fine). Here is my scenario:
@//Case 1# The page text is shown but the graphic elements based on jQuery are not shown at all
//Case 2# The page text and graphic elements are both shown
The file index.html is completely the same in both cases. I load jQuery in this file with this line:
I use Qt 4.8 and I cannot find the reason why I cannot get it to work for Case 1 as well. Note that for the index.html code above I intentionally use scr1pt instead of script because the forum wont let me have it in the original form.
Thanks for consideration!
I am not sure that QWebView "knows" QRC protocol ;) :D. Try to use normal web address from jQuery CDN:
[quote author="Peppy" date="1346003767"]I am not sure that QWebView "knows" QRC protocol ;) :D.[/quote]
The QUrl based on QRC path works fine when I load a page in QWebKit. The page is displayed, however the jQuery based drawings are not shown. If the same html code is loaded from a local file than the page displays the drawings fine, even though the html code in the local file uses QRC path to link to jQuery js files.
The html code (index.html) is exactly same file in both cases, and in this file the jQuery is linked using QRC path as shown below below:
Yes, QWebView using QUrl, but does it have WebKit Core ?
[quote author="Peppy" date="1346068934"]Yes, QWebView using QUrl, but does it have WebKit Core ? [/quote]
I don't think QUrl is used by webkit at all. QWebView uses QUrl to get the data from the source and delivers the data in a form of html string for WebKit to process.
Currently I use a workaround: I save the html code to a file and then use QWebView::load to open it. However it comes with the price of speed.