Rendering webpage(supported by html5 and javascript) from server machine to client machine



  • Hello Group,

    I am running QT webkit application on client system. My requirement is to render the web page (implemented using html5 and javascript) running on server and show it on Qwebview widget of client.

    In my code:

    ui->webView->load(QUrl("http://10.102.68.51:8080"));;

    Above code is properly populating Qwebview widget with server page on client. But the problem is there is a graph getting plotted dynamically on server web page using javascript, this graph is not getting plotted on client system.

    Can someone please guide me.

    Thanks
    Mohan



  • Hello,
    Could someone please reply me ??
    Regards
    Mohan



  • First off: Please be patient. Pushing your topic after only one hour is impolite and may cause you getting no answers at all.

    Did you have a look at [[doc:QWebSettings]] already? Maybe you need to tweak some of the settings there.



  • If I correctly undertand, the problem isn't in the code, but on the page (HTML).

    Can you post the link (img src) to the graph?



  • Hello Volker,

    Sorry for being impatient. I thought if I send a reminder, someone would respond immmediately. I shall not repeat this :)

    I tried with below Qwebsettings but still no solution. Can I know the specific Qwebsettings that can be used.

    @
    ui->webView->load(QUrl("http://10.102.68.51:8080/Appli"));

    ui->webView->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    ui->webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    

    @

    Hello TioRoy,
    If I try to launch the link in chromium browser, everthing works fine. I predict its not a problem with html.

    Thanks
    Mohan

    [Edit: Added @ tags around code -- mlong]



  • If your graph plotted by the javascript you should enable javascript in webcore.
    @ui->webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);@

    P.S.: also, set settings before loading web page...



  • Hello AcerExtensa

    I tried below code but still no solution.
    @
    ui->webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
    ui->webView->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
    ui->webView->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
    ui->webView->settings()->setAttribute(QWebSettings::JavaEnabled, true);
    ui->webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    ui->webView->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);

    ui->webView->load(QUrl("http://10.102.68.51:8080/Appli"));
    

    @

    [Edit: Added @ tags around code -- mlong]



  • Does it works with other browsers?


  • Moderators

    mrajanna, please be sure and wrap code snippets with @ tags so that they are formatted correctly. Thanks!



  • AcerExtensa,

    If I run "http://10.102.68.51:8080/Appli" on chromium browser, it perfectly works. However in Mozilla, it only displays web page and its contents but graph is not getting plotted. I just want to remind you, graph is plotted using javascript.

    Hello mlong,
    Iam sorry, I din't understand you.



  • mrajanna,

    You need to check for javascript errors.

    You can implement a class derived from QWebPage, and reimplement the javaScriptConsoleMessage.

    Check "this":http://www.developer.nokia.com/Community/Wiki/Redirecting_JavaScript_console_messages_in_a_Qt_hybrid_application page.


  • Moderators

    bq. Hello mlong,
    Iam sorry, I din’t understand you.

    See here for more details:

    http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01



  • mLong,

    FYI: web page ( html5 and javascript) is running on server(system near my system) and I am able to render that page on my system using Qtwebkit and display on Qwebview widget of my system. This mean I am able to render the page, but the problem is graph getting plotted in web page of server is not visible on my system.

    Excuse me if I am wrong, whether should I still follow the link provided by you?



  • I think you should follow the link.


  • Moderators

    mrajanna, as a forum moderator, I was referring to your posts on the forum (formatting your code in your messages, etc.) not responding to your question proper.



  • mlong,
    I shall take care of your point.

    I am still not able to fix the problem. Could someone help me.

    Thanks
    Mohan



  • bq. I am able to render that page on my system using Qtwebkit and display on Qwebview widget

    so, if it works correctly, the problem is somewhere else...

    bq. graph getting plotted in web page of server

    You have when problem with your server(what ever it is)... What do you mean with "server" at all? some kind of software what do some work and outputs html page? What is it? Is it even Qt software or what?

    I don't think we can help you without code samples(I mean html page what you got from server)...



  • FYI server side configurations: Tomcat server running html5 page embedded with JSF script on server side. Tomcat uses RFC 6455 websocket protocol.

    Observation made:
    I just discovered the problem by using wireshark.

    a) When request is sent from chromium browser client, it uses  RFC 6455 websocket protocol. Hence it works.
    
    b) But Websocket protocol used by Qtwebkit is something other than  RFC 6455. So only connection is getting established with server but data transmission does not happen.
    

    Is there is a way to add patch to QtWebkit to support RFC 6455 protocol ?



  • Each browser (like QTWebKit) implements websockets differently. Check "this":http://en.wikipedia.org/wiki/WebSocket and "this":http://en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations.

    I guess qtwebkit uses "hybi-07":http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-07 (check this "thread":http://qt-project.org/forums/viewthread/10106). But checking Qt5 sources, I think it uses hybi-10.

    Which version of Qt do you use?



  • TioRoy,

    From the Makefile generated for .pro file from qmake command, I see
    #Generated by qmake (2.01a) (Qt 4.8.1) on: Fri Oct 12 05:49:57 2012

    I download Qt5 from below link:
    http://releases.qt-project.org/qt5.0/beta1/qt-linux-opensource-5.0.0-beta1-x86-ubuntu1204-offline.run

    After using Qt5, Now I observe graph is getting plotted properly. My problem is solved :)

    Thanks for spending your time in answering my questions.

    Thanks to Qt5 too.

    Regards
    Mohan


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.